dumdumsareyum Posted July 6, 2007 Share Posted July 6, 2007 I'm looking for a string function that will allow me to take a string with uppercase and lower case letters and add a space before the uppercase letters, e.g. "LeeHarveyOswald" becomes " Lee Harvey Oswald". Thanks! Link to comment https://forums.phpfreaks.com/topic/58783-solved-string-question/ Share on other sites More sharing options...
teng84 Posted July 6, 2007 Share Posted July 6, 2007 regular expression function deInterCaps($var){ return ucfirst(ereg_replace("[A-Z]"," \\0",$var)); } $interCapsString = "aLoadOfNonsenseToDemonstrateTheFunction"; echo deInterCaps($interCapsString); // output: A load of nonsense to demonstrate the functio that alos tranform the first lettet to upper if you dont want that then rumove the ucfrist Link to comment https://forums.phpfreaks.com/topic/58783-solved-string-question/#findComment-291645 Share on other sites More sharing options...
dumdumsareyum Posted July 6, 2007 Author Share Posted July 6, 2007 muchas gracias Link to comment https://forums.phpfreaks.com/topic/58783-solved-string-question/#findComment-291651 Share on other sites More sharing options...
teng84 Posted July 6, 2007 Share Posted July 6, 2007 mark this as solved k Link to comment https://forums.phpfreaks.com/topic/58783-solved-string-question/#findComment-291653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.