cfloop index=thisItem list=#category#
#thisItem#br
/cfloop
-Original Message-
From: nicolai bass dh [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 23, 2007 11:07 AM
To: CF-Talk
Subject: Explode a string to single values
Hi,
i´m a CF newbie and i have a question:
I want to
cfset category = listToArray(category) /
cfdump var=#category# /
On 8/23/07, nicolai bass dh [EMAIL PROTECTED] wrote:
Hi,
i´m a CF newbie and i have a question:
I want to explode a variable into the single values. For example:
cfset category=one,two,three
I want to known the single values,
Hi Randy,
thanks a lot for your fast answer.
But now, i have the next question:
What is to if i want to print out exactly one value of the array.
For example, the third value.
In PHP i can print the value out with $thisitem[3];
How can i realise this with CF?
Thanks a lot for your help
#array[3]#
BTW: Charlie had a faster way to dump the list element into an array.
-Original Message-
From: nicolai bass dh [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 23, 2007 11:28 AM
To: CF-Talk
Subject: Re: Explode a string to single values
Hi Randy,
thanks a lot for your
Well it is already a common list and there are a number of list functions
readily available in CF as well as a list type available in cfloop. There
is also listtoArray() which is what you are looking for in this case.
Just give it the list variable and delimiter (default delimiter is a comma
so
it's not an array at this point (all you've done is looped over the
list and output each of it's elements), so you can't.
as i said earlier (it may not have made it to the list yet... )
cfset myArray = listToArray(itemlist) /
now you have an array
cfoutput#myArray[3]#/cfoutput
On 8/23/07,
To summarise, Coldfusion does the explode thing with a 'list' syntax and you
can do a lot with it. You don't need to convert the string into an array if
you use the functions Coldfusion gives you (although using an array can be
better for performance if that is a concern).
Livedocs has an index
7 matches
Mail list logo