You've gotta love this bit of code:

REreplace(arguments.strInputString,"(.)(.)","\1#arguments.strDelimiter#\2#ar
guments.strDelimiter#","ALL")

lol

Oh come on, that's funny! :OD

Adrian


> -----Original Message-----
> From: Christophe Maso [mailto:zum...@hotmail.com]
> Sent: 19 March 2009 23:37
> To: cf-talk
> Subject: Re: String to List?
> 
> 
> Thanks all!  Good stuff all around...really must get myself locked onto
> regex one of these days :).
> 
> I came up with this:
> 
> <cffunction name="stringToDelimListRE" access="public"
> returnType="string" output="false" hint="Takes a string argument and
> inserts the second argument between each character.  Using reg ex, is
> much, much faster than the original  looping function.">
> 
>       <cfargument name="strInputString" type="string" required="yes">
>       <cfargument name="strDelimiter" type="string" required="no"
> default=",">
> 
> 
>       <cfset var strNewList = "">
> 
>       <!--- account for empty string as input string --->
>       <cfif arguments.strInputString EQ "">
>               <cfreturn "">
>       </cfif>
> 
>       <!--- account for empty value of strDelimiter --->
>       <cfif not len(arguments.strDelimiter)>
>               <cfset arguments.strDelimiter=",">
>       </cfif>
> 
>       <cfset
> strNewList=REreplace(arguments.strInputString,"(.)(.)","\1#arguments.st
> rDelimiter#\2#arguments.strDelimiter#","ALL")>
> 
>         <!--- Get rid of 'hanging' delimiter at end of list --->
>       <cfset strNewList=mid(strNewList,1,len(strNewList)-1)>
> 
>       <cfreturn strNewList>
> 
> </cffunction>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320735
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to