If you've ever used Oracle, the Initcap function comes in quite handy. This ColdFusion function can be thrown in a cfc. It returns a capitalized letter for the first letter of each word that is passed into the function. Its really nice to use when displaying someones name that is being pulled from a database that is has all caps or something. It can also be useful for using it before you insert form data into the database.
-
<cffunction name="initCap" access="public" output="false" returntype="String" hint="I capitalize the first letter of every word group">
-
<cfargument name="inputString" required="false" type="String" default="" />
-
<cfreturn rereplace(lcase(arguments.inputString), "(\b\w)", "\u\1", "all") />
-
</cffunction>