Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change 1st letter of each word in a string to CAPS

Status
Not open for further replies.

dv8er88

Programmer
Feb 21, 2005
42
US
I have a database and a lot of the info is all lower case like (8975 nw 5th ave, boca raton. fl).

How can I loop through and change each of the first letters in a word to Caps? (8975 Nw 5th Ave, Boca Raton. Fl).

Thanks
 
<cfset myAddress = '8975 nw 5th ave, boca raton. fl'>
<cfset myNewAddress = ''>
<cfloop index="i" list ="#myAddress#" delimiters=" ">
<cfset myUCase = Left(UCase("#i#" ), 1) & Right(#i#, Len(#i#)-1)>
<cfset myNewAddress = myNewAddress & myUCase & ' '>
</cfloop>
<cfoutput>#myNewAddress#</cfoutput>


hope it helps...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top