
String.split() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
812
|
ActionScript Language Reference
Usage
Note that slice() does not modify string; it returns a completely new string.
Example
var fullName = "Steven Sid Mumby";
middleName = fullName.slice(7, 10); // Assigns "Sid" to middleName
middleName = fullName.slice(-9, -6); // Also assigns "Sid" to middleName
See Also
String.substr(), String.substring(); “The slice() function,” and “Combining String Examina-
tion with Substring Extraction,” in Chapter 4
String.split() Method
convert a string into a series of array elements
Flash 5
string.split(delimiter)
Arguments
delimiter The character or series of characters at which to break string when forming
elements of the new array.
Returns
An array whose elements contain the substrings formed by breaking string into segments
demarcated by
delimiter.
Description
The split() method breaks a string into substrings, assigns those substrings to the elements
of an array, and returns that array. Contiguous occurrences of
delimiter without inter-
vening characters result in empty elements. For example, the following code:
owners = "terry,doug,,,jon";
ownersArray = owners.split(",");
assigns the following elements to ownersArray (elements 2 and 3 contain undefined):
0: terry
1: doug
2:
3:
4: jon
The split() method typically is used to convert a string