# [EMAIL PROTECTED] / 2007-04-25 00:16:40 +0300:
> 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.

implode(' ', preg_split('~(?=[[:upper:]])~', 'FooBarBaz', -1, 
PREG_SPLIT_NO_EMPTY));

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to