In true Perl fashion, there's more than one way to do it (tho, I wouldn't
recommend anything but the first):

<CFSET string="word1,word2,word3">
<CFSET OldDelim=",">
<CFSET NewDelim=Chr(13)&Chr(10)>
<!--- simple --->
<CFSET string1=ListChangeDelims(string,NewDelim,OldDelim)>
<!--- iterative --->
<CFSET string2="">
<CFLOOP LIST="#string#" INDEX="thisstring">
  <CFSET string2=ListAppend(string2,thisstring,NewDelim)>
</CFLOOP>
<!--- array --->
<CFSET string3a=ListToArray(string,OldDelim)>
<CFSET string3=ArrayToList(string3a,NewDelim)>
<!--- iterative 2 --->
<CFSET string4="">
<CFLOOP FROM="1" TO="#ListLen(string,OldDelim)#" INDEX="i">
  <CFSET string4=ListAppend(string4,ListGetAt(string,i,OldDelim),NewDelim)>
</CFLOOP>

Just to name a few ...

-Rick


-----Original Message-----
From: Peter Benoit [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 24, 2000 11:54 AM
To: '[EMAIL PROTECTED]'
Subject: splitting strings


if I have a string like word1,word2,word3

How could I split it in Cold Fusion into ?

word1
word2
word3

Thanks,
Pete

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
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.mail-archive.com/[email protected]/
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.

Reply via email to