serversphere
07-02-2006, 12:15 PM
Here's one I can't seem to wrap my head around. I want to parse a given string and explode it by capital letters in PHP. Example:
I have "MustangBlueHeadlining", and want to separate out the words to be:
Mustang
Blue
Headlining
in a single string with the spaces included ("Mustang Blue Headlining") or an array...
The problem I'm having is a simple way to test if a char is cap or not. Can't find a built in function that does this on php.net. The only way I can think to do it is parse through the string char by char and compare each letter to a pre-set array of capital letters... Anyone ever done this? Easier way? Thanks!
I have "MustangBlueHeadlining", and want to separate out the words to be:
Mustang
Blue
Headlining
in a single string with the spaces included ("Mustang Blue Headlining") or an array...
The problem I'm having is a simple way to test if a char is cap or not. Can't find a built in function that does this on php.net. The only way I can think to do it is parse through the string char by char and compare each letter to a pre-set array of capital letters... Anyone ever done this? Easier way? Thanks!
