2 Replies Latest reply on Jul 17, 2006 9:43 AM by ntsiii

    String To Array

    mike2281
      New to AS and want to convert a string to an array and back to the origional string, I realize I may have to write a parsing routine, but wonder if there are any built in utilities. Thanks...

      "text",0,"complex, text"

      [0] = "text"
      [1] = 0
      [2] = "complex, text"
        • 1. Re: String To Array
          Slafon Level 1
          For String->array, use the spli method of the String class
          For instance
          myArray = myString .split(",")
          The drawback is all commas (even the one in in "complex, text") will also be used as delimiters.

          To go the other way, use the join method of the Array class:
          myString = myArray.join(',');

          Hope that helps,

          Stefan
          • 2. Re: String To Array
            ntsiii Level 3
            Can you use a delimiter other than comma? The pipe symbol is pretty rare in text. "|"

            Tracy