Format Names in ColdFusion

I thought I would share a quick bit of code to format names in ColdFusion. Simply all this does is capitalize the first letter of each name part, taking into consideration elements such as hyphens, apostrophes, roman numerals, and nicknames: William "Bill" Doe or William (Bill) Doe.

<cffunction name="nameFormat" access="public" output="false" returntype="string">
    <cfargument name="name" required="true" type="string">
    <cfset var n = lcase(trim(>
    <cfset var final = "">
    <cfset var word_delims = " |'|-|,|(|"& '"'>

    <cfset finished = "">
    <cfloop list="#word_delims#" index="i" delimiters="|"><!--- delimiters --->
        <cfset count = 1>
        <cfloop index="j" list="#n#" delimiters="#i#"><!--- replace nearby chars to delimiters --->
            <cfif REFindNoCase("^(I|X|V)+$", j) neq false><!--- group of roman numerals --->
                <cfset j = ucase(j)>
                <cfset j = REReplaceNoCase(j, "^[a-z]{1}",ucase(left(j,1)), "one")><!--- just caps the first letter --->

            <cfif count gt 1>
                <cfset final = final & i & j>
                <cfset final = j>
            <cfset count = count + 1>
        <cfset n = final>

    <cfreturn final />

The function only takes one parameter, which is the string of the name, and returns the newly formatted string name. As you can see it has a couple loops, which may not be entirely efficient, but it seems to be pretty thorough. Enjoy!