try the listToArray() function, built in to cf

using the ; as your delimiter.

tw

-----Original Message-----
From: Nicolas CHALLEL
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 9:45 AM
To: CF-Talk
Subject: string to array problem

Hello,

I would like to split the following string called myLine in several string
recorded in an array called myTab. Coldfusion crash with my conditional loop
... what should I use instead ? I tried with <cfif #CountCar# neq
#char(59)#> but it returns an error message

Would you please have a good idea ?

<cfset n=0>
<cfset myLine="I;wonder;how;to;do;it">
<cfset myTab=ArrayNew(1)>

<cfloop index="split" from="1" to="#Len(myLine)#">
    <cfoutput>
        <cfset word="">
        <cfset CountCar=#Mid(myLine,split,1)#>

            <cfloop condition="#CountCar# neq #Chr(59)#">
                <cfset word=word&CountCar>
            </cfloop>

        <cfset n = n + 1>
        <cfset myTab[n]=word>
    </cfoutput>
</cfloop>

<cfset n=0>
<cfloop index="i" from=1 to =10>
<cfset n=n+1>
<cfoutput>[#n#]<br></cfoutput>
</cfloop>

Thanks,
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to