String
Syntax
- "one"
- 'two'
- String elements are zero-based.
- The String class is a wrapper for the string primitive data type.
- Strings are immutable; an operation that modifies a string
returns a new string.
- String literals can be delimited by single or double quotes.
- length : The number of characters in the string.
- charAt(index) : Returns the character at the specified index.
- indexOf(search-str [,start-index]) : Returns the index number of the first occurrence of the search string (searches from left to right, starting from start-index).
- lastIndexOf(search-str [,start-index]) : Returns the index number of the last occurrence of the search string (searches from right to left, starting from start-index).
- substr(start-index [, length]) : Returns a substring.
- substring(start-index [, end-index]) : Returns a substring; the indexes do not have to be in numerical order.
- toLowerCase() : Returns a lowercase copy of the string.
- toUpperCase() : Returns an uppercase copy of the string.
\b : BackspaceExamples
\f : Form feed
\n : New line
\r : Carriage return
\t : Tab
\' : Apostrophe or single quote
\" : Double quote
\ : Backslash
var str1:String = "This is a double-quote string";
var str2:String = 'This is a single-quote string';
var x:Number = str1.length;
var str3:String = String("This is another string");