Dip into Java first maybe then back to CF? <cfset str = "abcdefg"> <cfset arr = str.split("")>
<cfdump var="#arr#"> <!--- <cfset ArrayDeleteAt(arr, 1)> ---> <cfset str = ArrayToList(arr, ",")> <cfdump var="#str#"> Note the the first element in the array is an empty string. I thought ArrayDeleteAt() would take care of that but it throws an error. I'd be interested to see if you find nice one or two line answer to this. Adrian > -----Original Message----- > From: Christophe Maso [mailto:zum...@hotmail.com] > Sent: 19 March 2009 21:31 > To: cf-talk > Subject: String to List? > > > Disclaimer - I haven't had to do any fancy string manipulation in a > while... > > I had thought that ANY string can be treated like a list (for example, > such that "abcdef" can be treated as a list containing six elements and > a delimiter of ""). Not so, I recently discovered when I tried to use > listChangeDelims("abcdef", ",", ""). I wanted to input "abcdef" and > get "a,b,c,d,e,f" returned, but CF doesn't recognize an empty value as > a valid delimiter for any of its list functions...and it doesn't accept > an empty value as the second argument in replace(), either. > > So I wrote a function that'll do what I want, taking a string and the > desired delimiter as arguments, then looping through each character in > the string and inserting the delimiter after it (except for the last > character in the string). But as one might imagine, it's SLOW for very > long strings. String and list manipulation is kid stuff, or so I'd > thought...surely there's a faster, simpler means? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:320716 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4