So I’m working on (what I’d consider a very small) problem: I need to convert a string to an array, then loop that array and do ‘something’ to each value.

For some reason, that’s beyond my understanding, I can’t get the following code to work (I get ‘invalid com/struct’ errors):

  1. <cfset MyList  = "1,2,3,4">
  2.         <cfset MyArray = ListToArray(MyList)>
  3.         <cfloop collection="#MyArray#" item="i">
  4.                 <cfoutput>#i#:#MyArray[i]#</cfoutput>
  5.         </cfloop>
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • StumbleUpon
  • Technorati
  • email
  • NewsVine