Converting a String to an Array: Use the String.split(delimiter, maximum_number_of_elements_to_place_into_the_new_array) method. : split « Array « Flash / Flex / ActionScript






Converting a String to an Array: Use the String.split(delimiter, maximum_number_of_elements_to_place_into_the_new_array) method.

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var list:String = "Piper picked a peck of pickled peppers";
        var words:Array = list.split(" ");
        
        trace(words);

    }
  }
}

        








Related examples in the same category

1.The split() method asks that you specify the delimiter it should use to determine the elements of the list