Re: String to List?
Interesting stuff - vodoo regex wonders :) Dominic > > Running on CF8, I used cftimer to test execution time on a string 360K long > (all alphanumerics, just alphabet appended with 1 to 0 and concatenated > 10,000 times). No cfdump or output; just a cfset statement. > > My original function - over 60 seconds, times out. this.s**tCan(). > ArrayToList( myString.toCharArray() ) - 188 ms > StringToDelimListRE() (the one with the ASCII breasts (Hah, I missed that)) - > 172 ms > listFromChars() - 125 ms > > I'm not 100% positive on which ones will/will not accept non-alphanumerics in > the string; didn't test for that in all cases. Anyone else care to time > these out? In any ase, there's something to be said for using only 1 line of > code - well worth the price of a few millseconds in my book, so long as I > don't have to run this process on War & Peace... > > ~| 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:320774 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
I just noticed that listFromChars() is essentially 1 line of code, also. My bad... Bottom line for me is to learn regex and more Java! ~| 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:320766 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
> I'd be interested to know how the code I suggested performs in > comparison to the regex with the 360k string - in theory it > outperform > it: > > Running on CF8, I used cftimer to test execution time on a string 360K long (all alphanumerics, just alphabet appended with 1 to 0 and concatenated 10,000 times). No cfdump or output; just a cfset statement. My original function - over 60 seconds, times out. this.s**tCan(). ArrayToList( myString.toCharArray() ) - 188 ms StringToDelimListRE() (the one with the ASCII breasts (Hah, I missed that)) - 172 ms listFromChars() - 125 ms I'm not 100% positive on which ones will/will not accept non-alphanumerics in the string; didn't test for that in all cases. Anyone else care to time these out? In any ase, there's something to be said for using only 1 line of code - well worth the price of a few millseconds in my book, so long as I don't have to run this process on War & Peace... ~| 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:320765 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: String to List?
Ermm, no, I thought they looked like eyes! :OD > -Original Message- > From: Dawson, Michael [mailto:m...@evansville.edu] > Sent: 20 March 2009 13:31 > To: cf-talk > Subject: RE: String to List? > > > Are you referring to the ASCII breasts? > > Thanks, > Mike > > -Original Message- > From: Adrian Lynch [mailto:cont...@adrianlynch.co.uk] > Sent: Thursday, March 19, 2009 6:20 PM > To: cf-talk > Subject: RE: String to List? > > > 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 > > ~| 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:320761 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: String to List?
Are you referring to the ASCII breasts? Thanks, Mike -Original Message- From: Adrian Lynch [mailto:cont...@adrianlynch.co.uk] Sent: Thursday, March 19, 2009 6:20 PM To: cf-talk Subject: RE: String to List? 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 ~| 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:320757 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
I'd be interested to know how the code I suggested performs in comparison to the regex with the 360k string - in theory it outperform it: Regex seems a little ott in this situation. > I created a string 360k chars long for testing - this function processed it 9 > times faster than my old function (which loops through every char in the > string). ~| 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:320756 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: String to List?
>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 Yeah, I know. :) I haven't added regex to my knowledge repertoire yet, so I just modified the code snippet offered in the third post (#REreplace(list,"(.)(.)","\1,\2,","ALL")#). Mine's not as pretty as it could be, but is a vast improvement from my original function. I created a string 360k chars long for testing - this function processed it 9 times faster than my old function (which loops through every char in the string). ~| 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:320755 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: String to List?
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: > > 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."> > > >default=","> > > > > > > > > > > > > > > >strNewList=REreplace(arguments.strInputString,"(.)(.)","\1#arguments.st > rDelimiter#\2#arguments.strDelimiter#","ALL")> > > > > > > > ~| 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
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: ~| 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:320734 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
Hoorah! 2009/3/19 Peter Boughton : > >>This also does it quite nicely: >> >> > > And far more efficiently too! > > You win. :) > > ~| 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:320733 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: String to List?
So many cool ways and only one cat to skin ;-) Wil 2009/3/19 Peter Boughton > > >This also does it quite nicely: > > > > > > And far more efficiently too! > > You win. :) > > ~| 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:320732 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
>This also does it quite nicely: > > And far more efficiently too! You win. :) ~| 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:320731 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
holy crap that is really cool :) On Thu, Mar 19, 2009 at 3:02 PM, Dominic Watson < watson.domi...@googlemail.com> wrote: > > This also does it quite nicely: > > > > Dominic > > 2009/3/19 Peter Boughton : > > > >>holy crap that is really cool :) > > > > Yep. :) > > > > > > For a full explanation of the last regex there: > > > > \B|(? > > > Summarised as "Any char boundary that is not at the start or end of the > text". > > > > In detail... > > > > \B # as above, any WordChar-WordChar or NonWordChar-NonWordChar > boundary. > > | # or (not inside parens, so applies to whole expression) > > (? = start of text) > > \b # any WordChar-NonWordChar or NonWordChar-WordChar boundary > (opposite of \B) > > (?!$) # negative lookahead - previous match must not occur before $ > (where $ = end of text) > > > > > > > > > > ~| 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:320730 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: String to List?
I knew there'd be something in Java! > -Original Message- > From: Dominic Watson [mailto:watson.domi...@googlemail.com] > Sent: 19 March 2009 22:03 > To: cf-talk > Subject: Re: String to List? > > > This also does it quite nicely: > > > > Dominic ~| 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:320729 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: String to List?
This also does it quite nicely: Dominic 2009/3/19 Peter Boughton : > >>holy crap that is really cool :) > > Yep. :) > > > For a full explanation of the last regex there: > > \B|(? > Summarised as "Any char boundary that is not at the start or end of the text". > > In detail... > > \B # as above, any WordChar-WordChar or NonWordChar-NonWordChar boundary. > | # or (not inside parens, so applies to whole expression) > (? start of text) > \b # any WordChar-NonWordChar or NonWordChar-WordChar boundary (opposite > of \B) > (?!$) # negative lookahead - previous match must not occur before $ (where $ > = end of text) > > > > ~| 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:320728 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
>holy crap that is really cool :) Yep. :) For a full explanation of the last regex there: \B|(?http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320727 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
Had to look up what the \B represented. "\B matches at any position between two word characters as well as at any position between two non-word characters." holy crap that is really cool :) On Thu, Mar 19, 2009 at 3:11 PM, Peter Boughton wrote: > > >Of course, this is usually where somebody proves me wrong and posts > >something really cool > > My pleasure... ;) > > > > > > > > > > > Can also use CF rereplace: > 'all' ) /> > > > These will work fine if the string is only alphanumerics - will need a > bigger expression if the string might contain other stuff. > > Like this: > > Arguments.Delimiter ) /> > > (that one doesn't have a CF equivalent, since CF regex can't do lookbehind) > > ~| 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:320725 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
>Of course, this is usually where somebody proves me wrong and posts >something really cool My pleasure... ;) Can also use CF rereplace: These will work fine if the string is only alphanumerics - will need a bigger expression if the string might contain other stuff. Like this: (that one doesn't have a CF equivalent, since CF regex can't do lookbehind) ~| 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:320717 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: String to List?
Dip into Java first maybe then back to CF? 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
Re: String to List?
#REreplace(list,"(.)(.)","\1,\2,","ALL")# heh...not technically "list" manipulation ~| 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:320713 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
Nope. any character can be a delimiter. you can consider the 'c' in 'abcdef' a delimiter between 'ab', and 'def'. But yeah, there has to be a delimiter. I don't think there's a way to do it other than what you've come up with... looping over the string and inserting the desired delimiter. Of course, this is usually where somebody proves me wrong and posts something really cool :) On Thu, Mar 19, 2009 at 2:30 PM, Christophe Maso wrote: > > 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:320712 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: string to list???
Thanx josh now it is working fine bai nagesh -Original Message- From: Josh Black [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 04, 2000 12:39 AM To: [EMAIL PROTECTED] Subject: Re: string to list??? Any string with spaces in it can automatically be treated as a space delimited list. No conversion is necessary. Example: #loopindex# This will produce the output of: This is my test string HTH Josh - Original Message - From: "Nagesh Kumar Deva" <[EMAIL PROTECTED]> To: "Cold Fusion (E-mail)" <[EMAIL PROTECTED]> Sent: Wednesday, May 03, 2000 9:05 AM Subject: string to list??? > hello everybody, > > is there a way to convert a string into a list?? the delimeter in string & > list to be space. is this possible?? > > plzz help me, i am stuck with it. > > thanx in advance > > nag > -- > Archives: http://www.eGroups.com/list/cf-talk > To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. > -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: string to list???
Any string with spaces in it can automatically be treated as a space delimited list. No conversion is necessary. Example: #loopindex# This will produce the output of: This is my test string HTH Josh - Original Message - From: "Nagesh Kumar Deva" <[EMAIL PROTECTED]> To: "Cold Fusion (E-mail)" <[EMAIL PROTECTED]> Sent: Wednesday, May 03, 2000 9:05 AM Subject: string to list??? > hello everybody, > > is there a way to convert a string into a list?? the delimeter in string & > list to be space. is this possible?? > > plzz help me, i am stuck with it. > > thanx in advance > > nag > -- > Archives: http://www.eGroups.com/list/cf-talk > To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. > -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: string to list???
You can have a list with a space as the delimeter. If you have punctuation or double spaces you would simply do a replace on them with a single space. HTH, Steve -Original Message- From: Nagesh Kumar Deva [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 03, 2000 12:06 PM To: Cold Fusion (E-mail) Subject: string to list??? hello everybody, is there a way to convert a string into a list?? the delimeter in string & list to be space. is this possible?? plzz help me, i am stuck with it. thanx in advance nag -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: string to list???
Can you give an example of what your trying to do? Like: "I'm trying to turn 1,2,3 into 1&2&3" --Katrina Katrina Chapman Consultant Ameriquest Mortgage Nagesh Kumar Deva To: "Cold Fusion (E-mail)" <[EMAIL PROTECTED]> Subject: string to list??? 05/03/00 09:05 AM Please respond to cf-talk hello everybody, is there a way to convert a string into a list?? the delimeter in string & list to be space. is this possible?? plzz help me, i am stuck with it. thanx in advance nag -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.