Separating words based on capital letter
| From: | Dotan Cohen | Date: | Tue, 24 Apr 2007 21:16:40 +0000 |
| Subject: | Separating words based on capital letter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-253622@lists.php.net to get a copy of this message | ||
I have some categories named in the database as such:
OpenSource
HomeNetwork
I'd like to add a space before each capital letter, ideally not
including the first but I can always trim later if need be. As I'm
array_walking the database, I have each value at the moment I need it
in a string $item. Other than pregging for A-Z how can I accomplish
this? I haven't been able to get it down to less than 54 lines of
code, which in my opinion means that I'm doing something wrong.
Thanks in advance for any ideas.
Dotan Cohen
http://dotancohen.com/howto/root_email.php
http://lyricslist.com/lyrics/lyrics/112/19/adams_bryan/waking_up_the_neighbours.html