RE: Cfloop List Multiple Charecter Delimiters

2010-02-12 Thread Paul Alkema

Hey guys thank you all for your help. I think the answer to my original
question is no ColdFusion doesn't support multiple character delimiters
however there are a few options for replacements.

Charlie, I actually have been using conditional statements like your example
for instances where I need to use multiple character delimiters, I just
wasn't sure if there was a better way of doing this. 

Thanks though!
Paul

-Original Message-
From: Leigh [mailto:cfsearch...@yahoo.com] 
Sent: Thursday, February 11, 2010 10:55 PM
To: cf-talk
Subject: Re: Cfloop List Multiple Charecter Delimiters


 My answer was just... keep it simple :)

Always good advice :)


  



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330641
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-12 Thread ColdFusion Developer

Why not make a duplicate of the list, use RegExp to replace oat with a
single delimiter such as a pipe | and then loop though the list. That way
you only have to do the loop once.




On Fri, Feb 12, 2010 at 9:12 AM, Paul Alkema paulalkemadesi...@gmail.comwrote:


 Hey guys thank you all for your help. I think the answer to my original
 question is no ColdFusion doesn't support multiple character delimiters
 however there are a few options for replacements.

 Charlie, I actually have been using conditional statements like your
 example
 for instances where I need to use multiple character delimiters, I just
 wasn't sure if there was a better way of doing this.

 Thanks though!
 Paul

 -Original Message-
 From: Leigh [mailto:cfsearch...@yahoo.com]
 Sent: Thursday, February 11, 2010 10:55 PM
 To: cf-talk
 Subject: Re: Cfloop List Multiple Charecter Delimiters


  My answer was just... keep it simple :)

 Always good advice :)






 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330643
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-12 Thread Peter Boughton

Do this:

cfloop index=i array=#variables.exampleList.split('oat')#
...
/cfloop 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330646
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-12 Thread Aaron Neff

Hi Paul,

Just fyi, CF9 added a 4th parameter (boolean multiCharacterDelimiter) to the 
listToArray function:

cfloop array=#listToArray(variables.myList, 'oat', false, true)# index=i

You have a few options!

HTH,
-Aaron

I have a list that I'm trying to loop, I was wondering if it was possible to
have multiple character delimiter. 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330665
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Cfloop List Multiple Charecter Delimiters

2010-02-12 Thread Paul Alkema

Hey Aaron, Thanks for the information. Very helpful. :)

Paul


-Original Message-
From: Aaron Neff [mailto:w...@itisdesign.com] 
Sent: Friday, February 12, 2010 1:05 PM
To: cf-talk
Subject: Re: Cfloop List Multiple Charecter Delimiters


Hi Paul,

Just fyi, CF9 added a 4th parameter (boolean multiCharacterDelimiter) to
the listToArray function:

cfloop array=#listToArray(variables.myList, 'oat', false, true)#
index=i

You have a few options!

HTH,
-Aaron

I have a list that I'm trying to loop, I was wondering if it was possible to
have multiple character delimiter. 



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330669
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-12 Thread Charlie Griefer

Treating 'OAT' as a deimiter isn't going to get you what you want.

The delimiter is not considered part of the list element itself.

So if you have GOAT,BOAT,MOAT,BOOBS, and you want to delimit on the string
'OAT', if you're successful then you'd end up with:

G,B,M,BOOBS

... because the delimiter that you specified (OAT) is now defined as just
that... a delimiter that's not going to be returned with the list element.

I suppose you could output the loop index and concatenate an OAT onto it.
 But that's assuming the business rule that you're looking to satisfy is
that the word *ends* with OAT.  Originally you said contains.  So what if
it's Goats, plural?


So... you've got working code that currently loops over the list, and does a
conditional check for each iteration.  You're looking for a better way.

Better is subjective.  Unless you're encountering performance issues that
you can attribute to your loop and the subsequent conditional... what would
be better?  Doing it in one line?  Is that better?  If another developer
has to work on this code, would he or she easily understand what the code
does?

For me, part of better is legible code.  You described a need.  I need to
loop over this list, and if the list element contains OAT, show it.  The
loop/conditional code is almost a literal translation of that need.  Anyone
should be able to easily maintain that code.

You can get into some ninja regular expression mindset and probably do what
you're looking to do.  But in the end... what does it buy you?  Is the code
more performant?  Is it easier to read?

Just my $0.02 :)

On Fri, Feb 12, 2010 at 11:54 AM, Paul Alkema
paulalkemadesi...@gmail.comwrote:


 Hey Aaron, Thanks for the information. Very helpful. :)

 Paul


 -Original Message-
 From: Aaron Neff [mailto:w...@itisdesign.com]
 Sent: Friday, February 12, 2010 1:05 PM
 To: cf-talk
 Subject: Re: Cfloop List Multiple Charecter Delimiters


 Hi Paul,

 Just fyi, CF9 added a 4th parameter (boolean multiCharacterDelimiter) to
 the listToArray function:

 cfloop array=#listToArray(variables.myList, 'oat', false, true)#
 index=i

 You have a few options!

 HTH,
 -Aaron

 I have a list that I'm trying to loop, I was wondering if it was possible
 to
 have multiple character delimiter.



 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330671
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Paul Alkema

Hey all,
I have a list that I'm trying to loop, I was wondering if it was possible to
have multiple character delimiter.

For example..

!--- create list ---
cfset variables.exampleList = Boat,Goat,Moat,CherryPie

!--- output only the words that contain oat ---
cfloop list=#variables.exampleList# index=i delimiters=oat
#i#
/cfloop


I would like something like the above to work, but instead it outputs all
that contain a B,O,A or a T.

Any ideas? :)

Thanks,
Paul


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330626
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Phillip Vector

I don't know if it would work and I'm shooting in the dark, but if you
made oat into a variable, would that work?

On Thu, Feb 11, 2010 at 1:57 PM, Paul Alkema
paulalkemadesi...@gmail.com wrote:

 Hey all,
 I have a list that I'm trying to loop, I was wondering if it was possible to
 have multiple character delimiter.

 For example..

 !--- create list ---
 cfset variables.exampleList = Boat,Goat,Moat,CherryPie

 !--- output only the words that contain oat ---
 cfloop list=#variables.exampleList# index=i delimiters=oat
        #i#
 /cfloop


 I would like something like the above to work, but instead it outputs all
 that contain a B,O,A or a T.

 Any ideas? :)

 Thanks,
 Paul


 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330627
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Paul Alkema

Good idea, but unfortunately it didn't work. Thanks though. :)

-Original Message-
From: Phillip Vector [mailto:vec...@mostdeadlygame.com] 
Sent: Thursday, February 11, 2010 5:00 PM
To: cf-talk
Subject: Re: Cfloop List Multiple Charecter Delimiters


I don't know if it would work and I'm shooting in the dark, but if you
made oat into a variable, would that work?

On Thu, Feb 11, 2010 at 1:57 PM, Paul Alkema
paulalkemadesi...@gmail.com wrote:

 Hey all,
 I have a list that I'm trying to loop, I was wondering if it was possible
to
 have multiple character delimiter.

 For example..

 !--- create list ---
 cfset variables.exampleList = Boat,Goat,Moat,CherryPie

 !--- output only the words that contain oat ---
 cfloop list=#variables.exampleList# index=i delimiters=oat
        #i#
 /cfloop


 I would like something like the above to work, but instead it outputs all
 that contain a B,O,A or a T.

 Any ideas? :)

 Thanks,
 Paul


 



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330629
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Phillip Vector

Ok.. then try this...

!--- create list ---
cfset variables.exampleList = Boat,Goat,Moat,CherryPie

cfset changedlist=ReplaceNoCase(#variables.exampleList#,oat,%)

!--- output only the words that contain oat ---
cfloop list=#ChangedList# index=i delimiters=%
cfset NewI=ReplaceNoCase(#changedlist#,%,oat)
   #NewI#
/cfloop

It's a bit of a kludge, but it should work if I understand the problem
correctly.

On Thu, Feb 11, 2010 at 2:06 PM, Paul Alkema
paulalkemadesi...@gmail.com wrote:

 Good idea, but unfortunately it didn't work. Thanks though. :)

 -Original Message-
 From: Phillip Vector [mailto:vec...@mostdeadlygame.com]
 Sent: Thursday, February 11, 2010 5:00 PM
 To: cf-talk
 Subject: Re: Cfloop List Multiple Charecter Delimiters


 I don't know if it would work and I'm shooting in the dark, but if you
 made oat into a variable, would that work?

 On Thu, Feb 11, 2010 at 1:57 PM, Paul Alkema
 paulalkemadesi...@gmail.com wrote:

 Hey all,
 I have a list that I'm trying to loop, I was wondering if it was possible
 to
 have multiple character delimiter.

 For example..

 !--- create list ---
 cfset variables.exampleList = Boat,Goat,Moat,CherryPie

 !--- output only the words that contain oat ---
 cfloop list=#variables.exampleList# index=i delimiters=oat
        #i#
 /cfloop


 I would like something like the above to work, but instead it outputs all
 that contain a B,O,A or a T.

 Any ideas? :)

 Thanks,
 Paul






 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330630
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Phillip Vector

Sorry...

cfset variables.exampleList = Boat,Goat,Moat,CherryPie

cfset changedlist=ReplaceNoCase(#variables.exampleList#,oat,%)

!--- output only the words that contain oat ---
cfloop list=#ChangedList# index=i delimiters=%
cfset NewI=ReplaceNoCase(#i#,%,oat)
  #NewI#
/cfloop

Again, this isn't tested and off the cuff.. But I think you get what
I'm trying to do here. :)

On Thu, Feb 11, 2010 at 2:12 PM, Phillip Vector
vec...@mostdeadlygame.com wrote:
 Ok.. then try this...

 !--- create list ---
 cfset variables.exampleList = Boat,Goat,Moat,CherryPie

 cfset changedlist=ReplaceNoCase(#variables.exampleList#,oat,%)

 !--- output only the words that contain oat ---
 cfloop list=#ChangedList# index=i delimiters=%
 cfset NewI=ReplaceNoCase(#changedlist#,%,oat)
       #NewI#
 /cfloop

 It's a bit of a kludge, but it should work if I understand the problem
 correctly.

 On Thu, Feb 11, 2010 at 2:06 PM, Paul Alkema
 paulalkemadesi...@gmail.com wrote:

 Good idea, but unfortunately it didn't work. Thanks though. :)

 -Original Message-
 From: Phillip Vector [mailto:vec...@mostdeadlygame.com]
 Sent: Thursday, February 11, 2010 5:00 PM
 To: cf-talk
 Subject: Re: Cfloop List Multiple Charecter Delimiters


 I don't know if it would work and I'm shooting in the dark, but if you
 made oat into a variable, would that work?

 On Thu, Feb 11, 2010 at 1:57 PM, Paul Alkema
 paulalkemadesi...@gmail.com wrote:

 Hey all,
 I have a list that I'm trying to loop, I was wondering if it was possible
 to
 have multiple character delimiter.

 For example..

 !--- create list ---
 cfset variables.exampleList = Boat,Goat,Moat,CherryPie

 !--- output only the words that contain oat ---
 cfloop list=#variables.exampleList# index=i delimiters=oat
        #i#
 /cfloop


 I would like something like the above to work, but instead it outputs all
 that contain a B,O,A or a T.

 Any ideas? :)

 Thanks,
 Paul






 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330631
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Leigh

 multiple character delimiter.

I believe CF does not support that natively. Check cflib.org. I have not tried 
them, but it looks like there are a few functions for multi-character delimiters

http://www.cflib.org/udf/splitMX
http://www.cflib.org/udf/split


  

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330632
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Charlie Griefer

Wouldn't it be pretty straightforward and more legible to just loop over the
list and do a conditional on each loop iteration?  Unless you've got a
ridiculously large list it should still perform well enough.

!--- create list ---
cfset variables.exampleList = Boat,Goat,Moat,CherryPie

!--- output only the words that contain oat ---
cfloop list=#variables.exampleList# index=i
   cfif i contains oat#i#/cfif
/cfloop

As far as your original question regarding multiple delimiters... cfloop
does accept multiple delimiters, but the implementation is that it looks for
any of those characters... not the characters as a string.

For example, cfloop list=#myList# index=i delimiters=,:

will look for the comma as a delimiter -or- the colon.

so Foo,Bar:Baz would be a 3 element list.

On Thu, Feb 11, 2010 at 2:28 PM, Leigh cfsearch...@yahoo.com wrote:


  multiple character delimiter.

 I believe CF does not support that natively. Check cflib.org. I have not
 tried them, but it looks like there are a few functions for multi-character
 delimiters

 http://www.cflib.org/udf/splitMX
 http://www.cflib.org/udf/split




 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330635
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Leigh

 Wouldn't it be pretty straightforward and more legible to

Yes, it should not be that hard to implement and probably with less code than 
one of those udf's. But the other looks elegant enough. You might see if it 
does the trick first, before re-inventing the wheel.


  

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330636
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Charlie Griefer

Leigh - just to clarify, I wasn't suggesting the straightforward loop
w/conditional was more straightforward/legible than the UDFs on cflib... I
meant in general compared to some of the suggestions so far in this thread.

Not taking anything away from any the suggestions themselves... they're all
good and I'm glad to see people making an effort to help and answer
questions.

My answer was just... keep it simple :)

On Thu, Feb 11, 2010 at 6:03 PM, Leigh cfsearch...@yahoo.com wrote:


  Wouldn't it be pretty straightforward and more legible to

 Yes, it should not be that hard to implement and probably with less code
 than one of those udf's. But the other looks elegant enough. You might see
 if it does the trick first, before re-inventing the wheel.




 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330637
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Cfloop List Multiple Charecter Delimiters

2010-02-11 Thread Leigh

 My answer was just... keep it simple :)

Always good advice :)


  

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330639
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4