earwig75
asked on
Change case of a string after a space
I have 2 variables, FirstName and LastName. These are always returned in CAPS. Sometimes the Firstname has a space and then a middle inital. So, the firstname might be something like BOB R.
On cfoutput I want to convert that to Bob R. Can someone assist? Basically, if there is a space and then another letter in the string I want the letter after the space to be uppercase as well.
Thank you.
On cfoutput I want to convert that to Bob R. Can someone assist? Basically, if there is a space and then another letter in the string I want the letter after the space to be uppercase as well.
Thank you.
ASKER
Receiving error: "The 2 parameter of the Right function, which is now 0, must be a positive integer."
Sometimes the name is just : BOB
Sometimes it is BOB S
Sometimes the name is just : BOB
Sometimes it is BOB S
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<cfset theName = "BOB MATHEW ROBERTSON">
<cfloop index="word" list="#theName#" delimiters=" ">
#ucase(left(word,1))##lcas
</cfloop>