Neither does mine!  And please note I commented it, so it looks long but is
actually only a few lines!

Paul

> -----Original Message-----
> From: Jeff Bevill [mailto:[EMAIL PROTECTED]]
> Sent: 27 October 2000 09:32
> To: CF-Talk
> Subject: RE: Capitalize First Letter of Each Word
>
>
> Rich,
>
> My "over complicated" code below (l33t w3rd fixer v1.0) doesn't fail on 1
> character.  For some reason I still have K&R style programming
> habits, heh.
>
> Jeff Bevill
> -----Original Message-----
> From: Rich Wild [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 27, 2000 2:10 AM
> To: CF-Talk
> Subject: RE: Capitalize First Letter of Each Word
>
>
> Steve,
>
> This code dies if single letter words are present in the string eg "i".
>
> Parameter 2 of function Right which is now "0" must be a positive integer,
> as CF so succinctly puts it.
>
> Added this:
>
> <cfset newword="">
> <cfloop index="word" list="#stringvar#" delimiters=" ">
>       <cfif Len(word) eq 1>
>               <cfset newword=ListAppend(newword, UCase(word), " ")>
>       <cfelse>
>               <cfset newword=ListAppend(newword, UCase(Left(word, 1)) &
> Right(word, Len(word)-1), " ")>
>       </cfif>
> </cfloop>
>
> And then, as cf_capitalize found - what about surnames Celtic stylee eg "
> O'Connolly ".
>
> <cfset newword="">
> <cfloop index="word" list="#stringvar#" delimiters=" ">
>       <cfif Len(word) eq 1>
>               <cfset newword=ListAppend(newword, UCase(word), " ")>
>       <cfelseif Find(Chr(39), word)>
>               <cfset newword=ListAppend(newword, UCase(Left(word, 3)) &
> Right(word, Len(word)-3), " ")>
>       <cfelse>
>               <cfset newword=ListAppend(newword, UCase(Left(word, 1)) &
> Right(word, Len(word)-1), " ")>
>       </cfif>
> </cfloop>
>
> -------------------------------------------------------
> Rich Wild
> Senior Web Designer
>
> -------------------------------------------------------
> e-mango.com ltd                      Tel: 01202 587 400
> Lansdowne Place                      Fax: 01202 587 401
> 17 Holdenhurst Road
> Bournemouth                   Mailto:[EMAIL PROTECTED]
> BH8 8EW, UK                      http://www.e-mango.com
> -------------------------------------------------------
> This message may contain information which is legally
> privileged and/or confidential.  If you are not the
> intended recipient, you are hereby notified that any
> unauthorised disclosure, copying, distribution or use
> of this information is strictly prohibited. Such
> notification notwithstanding, any comments, opinions,
> information or conclusions expressed in this message
> are those of the originator, not of e-mango.com ltd,
> unless otherwise explicitly and independently indicated
> by an authorised representative of e-mango.com ltd.
> -------------------------------------------------------
>
>
>
>
> > -----Original Message-----
> > From: Steve Martin [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, October 26, 2000 5:32 PM
> > To: CF-Talk
> > Subject: RE: Capitalize First Letter of Each Word
> >
> >
> > Or:
> >
> > <cfset variable="Some text to convert here">
> >
> > <cfset newword="">
> > <cfloop list="#variable# index=word delimiter=" ">
> >     <cfset newword=ListAppend(newword, UCase(Left(word, 1))
> > & Right(word,
> > Len(word)-1), " ")>
> > </cfloop>
> >
> > Steve
> >
> > > -----Original Message-----
> > > From: Jeff Bevill [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, October 26, 2000 14:50
> > > To: CF-Talk
> > > Subject: RE: Capitalize First Letter of Each Word
> > >
> > >
> > > John McKown,
> > >
> > > Here ya go man.  I only had about 10 mins to write this,
> > hope it works. :)
> > >
> > > <!--- l33t w3rd fixer v1.0 --->
> > > <!--- Jeff Bevill - [EMAIL PROTECTED] --->
> > >
> > > <cfset Variable="UnBeLiEvAbLe">
> > >
> > > <cfif isDefined("Variable") and Len(Variable) GT 0>
> > >   <cfset in="1">
> > >   <cfset out="0">
> > >   <cfset word_state=out>
> > >
> > >   <cfset NewStr="">
> > >   <cfset is_space=false>
> > >   <cfloop index=i from=1 to=#Len(Variable)#>
> > >           <cfset Character=Mid(Variable, i, 1)>
> > >
> > >           <cfif Character is " ">
> > >                   <cfset word_state=out>
> > >                   <cfset NewStr=NewStr & Character>
> > >           <cfelseif Asc(Character) GE Asc("a") and
> > > Asc(Character) LE Asc("z") and
> > > word_state EQ out>
> > >                   <cfset word_state=in>
> > >                   <cfset NewStr=NewStr & UCase(Character)>
> > >           <cfelseif Asc(Character) GE Asc("A") and
> > > Asc(Character) LE Asc("Z") and
> > > word_state EQ in>
> > >                   <cfset NewStr=NewStr & LCase(Character)>
> > >           <cfelse>
> > >                   <cfset word_state=in>
> > >                   <cfset NewStr=NewStr & Character>
> > >           </cfif>
> > >
> > >   </cfloop>
> > >
> > >   <cfset Variable=NewStr>
> > > </cfif>
> > >
> > > <cfoutput>#Variable#</cfoutput>
> > >
> > > Jeff Bevill
> > >
> > > -----Original Message-----
> > > From: John McKown [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, October 26, 2000 6:35 AM
> > > To: CF-Talk
> > > Subject: Capitalize First Letter of Each Word
> > >
> > >
> > > Can someone share a script that will capitalize the
> > > first letter of every word entered into a form field?
> > >
> > > John McKown, VP Business Services
> > > Delaware.Net, Inc.
> > > 30 Old Rudnick Lane, Suite 200 Dover, DE 19901
> > > email: [EMAIL PROTECTED]
> > > phone: 302-736-5515
> > > fax: 302-736-5945
> > > icq: 1495432
> > >
> > >
> > >
> > > ------------------------------------------------------------------
> > > ----------
> > > --------------------
> > > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> > > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> > > or send a
> > > message with 'unsubscribe' in the body to
> > > [EMAIL PROTECTED]
> > >
> > > ------------------------------------------------------------------
> > > ------------------------------
> > > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> > > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> > > or send a message with 'unsubscribe' in the body to
> > > [EMAIL PROTECTED]
> > >
> >
> > --------------------------------------------------------------
> > ----------------------------------
> > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> > Unsubscribe:
> > http://www.houseoffusion.com/index.cfm?sidebar=lists or send
> > a message with 'unsubscribe' in the body to
> > [EMAIL PROTECTED]
> >
> ------------------------------------------------------------------
> ----------
> --------------------
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> or send a
> message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]
>
> ------------------------------------------------------------------
> ------------------------------
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> or send a message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]
>


------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to