> Subject: RE: Capitalize First Letter of Each Word
Personally I think this should turn into a "Who can come up with the
longest, most convoluted, but beautifully artistic way to Capitalize
the First Letter of Each Word" competition.
Here's my attempt, I'm sure there are much longer sneakier ways.
------------
<cfset test = "This is a teSt i hope it works">
<cfset alpha = "abcdefghijklmnopqrstuvwxyz">
<cfset magicLower = 97>
<cfset magicUpper = 65>
<cfset numberList = 0>
<cfloop index="thisChar" from="#len(test)#" to="1" step="-1">
<cfset newNumber = Asc(mid(reverse(test),thisChar,1))>
<cfif newNumber EQ Evaluate((2^2)^2*2)>
<cfset newNumber = 0>
</cfif>
<cfset numberList = listAppend(numberList,newNumber)>
</cfloop>
<cfset oneLessCounter = 1>
<cfset newNumberList = ''>
<cfloop index="thisPosition" from="2" to="#listLen(numberList)#">
<cfif
int(listGetAt(numberList,oneLessCounter)+ListGetAt(numberList,thisPosi
tion)) EQ ListGetAt(numberList,thisPosition)>
<cfset newNumber = ListGetAt(numberList,thisPosition)>
<cfif newNumber GTE magicLower and newNumber LTE
int(magicLower+len(alpha))>
<cfset newNumber = int(newNumber -(magicLower-magicUpper))>
</cfif>
<cfset newNumberList = listAppend(newNumberList,newNumber)>
<cfelse>
<cfset newNumber = ListGetAt(numberList,thisPosition)>
<cfif newNumber GTE magicUpper and newNumber LTE
int(magicUpper+len(alpha))>
<cfset newNumber = int(newNumber +(magicLower-magicUpper))>
</cfif>
<cfset newNumberList = listAppend(newNumberList,newNumber)>
</cfif>
<cfset oneLessCounter = IncrementValue(oneLessCounter)>
</cfloop>
<cfset newString = ''>
<cfloop index="thisPosition" from="1"
to="#int(listLen(numberList)-1)#">
<cfif listGetAt(newNumberList,thisPosition) GTE magicUpper and
listGetAt(newNumberList,thisPosition) LTE int(magicUpper+len(alpha))>
<cfset newString = '#newString# '>
</cfif>
<cfset newString =
'#newString##chr(listGetAt(newNumberList,thisPosition))#'>
</cfloop>
<cfset newString = right(newString,int(len(newString)-1))>
<cfoutput>#newString#</cfoutput>
-----------------
Dan.
This message is intended only for the use of the person(s) ("the intended
recipient(s)") to whom it is addressed.
It may contain information which is privileged and confidential within the meaning of
the applicable law. If you are not the intended recipient, please contact the sender
as soon as possible.The views expressed in this communication may not necessarily be
the views held by Live Information Systems Limited.
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message
with 'unsubscribe' in the body to [EMAIL PROTECTED]