Skip to main content
April 19, 2006
Answered

bigString to Big String - how do I detect index of upper case?

  • April 19, 2006
  • 7 replies
  • 872 views


bigString to Big String - how do I detect index of upper case?

Is there a way to detect, insert space and replace the upper case letters in a string?

This topic has been closed for replies.
Correct answer
Aren't you looking to do this for a string regardless of what it is?

Something like...

yes, that works as well. Thank you. I put it into a function to make it more portable.

<cfscript>
function splitOnCase(word){
s = REReplace(word, "([A-Z])", " \1", "all");
s = REReplace(s, "(.+){1}", "\u\1");
return word;
}
</cfscript>

7 replies

Participating Frequently
April 19, 2006
Something like this?

<CFOUTPUT>#REReplace("bigString", "[A-Z]"," "& Mid("bigString", REfind("[A-Z]", "bigString"), 1))#</CFOUTPUT>

This will at least give you a break at the first upper case letter. You can then replace the first character in the result with an upper case as well, which I didn't do, since I figured that you knew how to do that.

Phil
April 19, 2006
WOOOOOOOOOOOOOOOO HOOOOOOOOOOOOOOOO!!!!

Thank you very much! I was very aggravated trying to figure that one out!
Inspiring
April 19, 2006
Aren't you looking to do this for a string regardless of what it is?

Something like...