String.substr(start [,length])
Top  Previous  Next


SWiSH Player Support
SWF5 or later - Supported Internally

Syntax
myString.substr(start [, length])

Arguments
start: An integer. The position of 1st character in myString to form substring. If start is a negative number, the starting position is determined from the end of the string, where the -1 is the last character.
length: An optional integer. The number of characters in the substring being created. If length is not specified, the substring includes all of the characters from the start to the end of the string.

Returns
Nothing.

Description
Method: Returns the substring formed from the characters in a string from the index specified in the start parameter through the number of characters specified in the length parameter. The substr method does not change the string specified by myString, it returns a new string.

Sample
onLoad () {
    str = "abcdefgbc";
    trace (str.substr(3,3));   // returns "def"
    trace (str);      // returns "abcdefgbc"
}