PHP: explode
- Started
- Last post
- 6 Responses
- cosmo
is there way to split or explode a string at caps. like: "ThisIsCapsLocked" i want the to be split to "This Is Caps Locked".
Anyone?
- fatkid0
...
- Nematoth0
don't think so man.. the explode function normally requires a character to use as a separator.. there is a function that tests for uppercase but only returns true if ALL letters are uppercase..
I guess what you could do is split the whole string into an array of single bytes and check each one for uppercase.. if it is uppercase then put all previous letters since last uppercase letter into one variable.. then continue.. and so on and so forth.. bit messy.. but seems like it might be the only way.. and don't ask me for code.. :)
hope that helps your thought process...
- cosmo0
thanks. thought about checking each character with ASCII, but thats a long process and don't feel like writing all that.
- gabriel20
I'm sure there's a way to do that using regular expressions.
- cosmo0
bingo, thanks gabriel2.
- quik0
Search each char of the string, if it is uppercase, insert a chr (whatever teh space code is) infront of it.