Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > String | |||
Object
|
+-String
public class String
extends Object
The String class is a wrapper for the string primitive data type, and provides methods and properties that let you manipulate primitive string value types. You can convert the value of any object into a string using the String() function.
All the methods of the String class, except for concat(), fromCharCode(), slice(), and substr(), are generic, which means the methods call toString() before performing their operations, and you can use these methods with other non-String objects.
Because all string indexes are zero-based, the index of the last character for any string x is x.length - 1.
You can call any of the methods of the String class using the constructor method new String or using a string literal value. If you specify a string literal, the ActionScript interpreter automatically converts it to a temporary String object, calls the method, and then discards the temporary String object. You can also use the String.length property with a string literal.
Do not confuse a string literal with a String object. In the following example, the first line of code creates the string literal first_string, and the second line of code creates the String object second_string:
var first_string:String = "foo"
var second_string:String = new String("foo")
Use string literals unless you specifically need to use a String object.
Availability: ActionScript 1.0; Flash Player 5 - (became a native object in Flash Player 6, which improved performance significantly).
|
Modifiers |
Property |
Description |
|---|---|---|
|
|
length |
An integer specifying the number of characters in the specified String object. |
Properties inherited from class Object
|
Signature |
Description |
|---|---|
|
String |
Creates a new String object. |
|
Modifiers |
Signature |
Description |
|---|---|---|
|
|
charAt |
Returns the character in the position specified by the parameter |
|
|
charCodeAt |
Returns a 16-bit integer from 0 to 65535 that represents the character specified by |
|
|
concat |
Combines the value of the String object with the parameters and returns the newly formed string; the original value, |
|
|
fromCharCode |
Returns a string comprising the characters represented by the Unicode values in the parameters. |
|
|
indexOf |
Searches the string and returns the position of the first occurrence of |
|
|
lastIndexOf |
Searches the string from right to left and returns the index of the last occurrence of |
|
|
slice |
Returns a string that includes the |
|
|
split |
Splits a String object into substrings by breaking it wherever the specified |
|
|
substr |
Returns the characters in a string from the index specified in the |
|
|
substring |
Returns a string comprising the characters between the points specified by the |
|
|
toLowerCase |
Returns a copy of the |
|
|
toString |
Returns an object's properties as strings regardless of whether the properties are strings. |
|
|
toUpperCase |
Returns a copy of the String object, with all lowercase characters converted to uppercase. |
|
|
valueOf |
Returns the primitive value of a String instance. |
Methods inherited from class Object addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch
Version 8
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00002697.html