next up previous contents
Next: substr Up: Methods Previous: slice   Contents


split

Description
Splits a String object into an array of strings by separating the string into substrings.


Syntax

  1. StringObj.split(delimiter, [limit])
  2. "String Literal".split(delimiter, [limit])


Parameters

delimiter
The character or string at which stringObj splits. If the delimiter parameter is undefined, the entire string is placed in the first element of the array.
limit
optional . The number of items to place into the array.


Returns

The result of the split method is an array of strings split at each point where delimiter occurred in stingObj. If you use an empty string ("") as a delimiter, each character in the string is placed as an element in the array.


Example

s = "This is an example of String.split";
r = s.split(" ");
trace(r);
//output: This,is,an,example,of,String.split




Copyright ©2000-2010 Shanghai TopCMM Software Technologies. All Rights Reserved.