[thelist] LCase, UCase, Sentence Case? <cf>

Joshua OIson joshua at alphashop.net
Thu Feb 22 17:33:29 CST 2001


No.  This may not be the most elogent answer, but it works too:

<cfset sentence = "hello world">
<cfset sentence = UCase(Left(sentence, 1)) & Right(sentence,
Len(sentence)-1)>
<cfset found_at = REFind(" [[:lower:]]", sentence)>
<cfloop condition="found_at">
  <cfset string_is = Mid(sentence, found_at, 2)>
  <cfset sentence = ReplaceNoCase(sentence, string_is, UCase(string_is),
"ALL")>
  <cfset found_at = REFind(" [[:lower:]]", sentence)>
</cfloop>

<cfoutput>#sentence#</cfoutput>

-joshua

You wrote,

> Is there a quick and dirty Sentence case function in CF






More information about the thelist mailing list