![MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual Download Page 655](http://html1.mh-extra.com/html/macromedia/flash-mx-2004-actionscript/flash-mx-2004-actionscript_reference-manual_3378897655.webp)
String.split()
655
See also
String.substr()
,
String.substring()
String.split()
Availability
Flash Player 5.
Usage
my_str
.split("
delimiter
", [
limit
])
Parameters
delimiter
The character or string at which
my_str
splits.
limit
The number of items to place into the array. This parameter is optional.
Returns
An array containing the substrings of
my_str
.
Description
Method; splits a String object into substrings by breaking it wherever the specified
delimiter
parameter occurs, and returns the substrings in an array. If you use an empty string (
""
) as a
delimiter, each character in the string is placed as an element in the array, as in the following code.
my_str = "Joe";
i = my_str.split("");
trace (i);
The Output panel displays the following:
J,o,e
If the
delimiter
parameter is undefined, the entire string is placed into the first element of the
returned array.
Example
The following example returns an array with five elements.
my_str = "P, A, T, S, Y";
my_str.split(",");
This example returns an array with two elements,
"P"
and
"A"
.
my_str.split(",", 2);
Summary of Contents for FLASH MX 2004 - ACTIONSCRIPT
Page 1: ...ActionScript Reference Guide...
Page 8: ...8 Contents...
Page 12: ......
Page 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Page 54: ...54 Chapter 2 ActionScript Basics...
Page 80: ...80 Chapter 3 Writing and Debugging Scripts...
Page 82: ......
Page 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Page 112: ......
Page 120: ...120 Chapter 6 Using the Built In Classes...
Page 176: ......
Page 192: ...192 Chapter 10 Working with External Data...
Page 202: ...202 Chapter 11 Working with External Media...
Page 204: ......
Page 782: ...782 Chapter 12 ActionScript Dictionary...
Page 793: ...Other keys 793 221 222 Key Key code...
Page 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Page 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Page 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Page 816: ...816 Index...