Just loop over the string like a list, but use step=2 instead of one. Ie

<cfloop index="x" from="1" to="#listLen(str)#" step="2">
        <cfset key = listGetAt(str,x,"|")>
        <cfset val = listGetAt(str,x+1,"|")>
        <cfoutput>#key#: #val#<br></cfoutput>
</cfloop>

You will want to make sure the list is 'proper' fist - thats as easy as
making sure listLen(str,"|") is even.

========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Les Mizzell [mailto:[EMAIL PROTECTED] 
> Sent: Monday, September 22, 2003 12:34 PM
> To: CF-Talk
> Subject: Breaking a String apart by replacing every other delimeter...
> 
> 
> How can I break this string apart:
> 
> Target Present|Yes|Unit Replaced|Yes|Unit Replaced|No|Comment|Wet
> 
> So I get:
> 
> Target Present: Yes
> Unit Replaced: No
> Comment: Wet
> 
> ...which is basically replacing every other "|" with 
> different thing.....
> 
> OK, something like:            
> #REPLACE(PDWBD.DynamicQuestions,'|','<br>')#
> using "MOD", right?  But, how to get a colon for the first one, ",br" 
> for the second, colon again.....the syntax eludes me at the moment....
> 
> ....and maybe count the rows at the same time so I could number them?
> 
> 1. Target Present: Yes
> 2. Unit Replaced: No
> 3. Comment: Wet
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137978
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to