-
1. Re: Seperating a text field
Carl Von Stetten Aug 30, 2012 12:49 PM (in response to userCold9)How about treating the resulting elements as a list as well (delimited by the forward slash):
<cfset itemID = "">
<cfset itemValue = "">
<cfloop index = "ListElement" list = "#nenen#" delimiters = ",">
<cfset itemID = listFirst(ListElement, "/")>
<cfset itemValue = listLast(ListElement, "/")
<!--- Do your comparison stuff here --->
</cfloop>
HTH,
Carl V.
-
2. Re: Seperating a text field
WolfShade Aug 30, 2012 12:48 PM (in response to userCold9)GetToken()
-
3. Re: Seperating a text field
Miguel-F Aug 30, 2012 12:55 PM (in response to userCold9)I have found an easy way to do this is treating your string segments as a ColdFusion list. Lists in ColdFusion are nothing more than strings with delimeters. By default the delimeter is a comma but you can change that to whatever you want.
So in your case you could do something like:
<cfset firstIndex = ListGetAt("1/rgrgrrtr",1,"/") />
<cfset firstValue = ListGetAt("1/rgrgrrtr",2,"/") />
<cfset secondIndex = ListGetAt("2/xcvxcvxcvx",1,"/") />
<cfset secondValue = ListGetAt("2/xcvxcvxcvx",2,"/") />
<cfset thirdIndex = ListGetAt("3/cccc",1,"/") />
<cfset thirdValue = ListGetAt("3/cccc",2,"/") />
etc.
Obviously you can change those variable names, use an array and keep appending values, or whatever. What I wanted to show you is how you can use the ListGetAt function to parse those strings for you. The BIG caveat here is that you must be sure the delimeter character (/ in your case) does not show up anywhere else in your string. If it does that will throw things off.



