S > String.substring |  |

String.substring

string, string.substring, substring

Availability

Flash Player 5.

Usage

    myString.substring(from, to)

Parameters

`from` An integer that indicates the position of the first character of `myString` used to create the substring. Valid values for `from` are`` 0 through `string.length` `- 1`. If `from` is a negative value, 0 is used.

`to` An integer that is 1+ the index of the last character in `myString` to be extracted. Valid values for `to` are 1 through`string.length`. The character indexed by the `to` parameter is not included in the extracted string. If this parameter is omitted, `string.length` is used. If this parameter is a negative value, 0 is used.

Returns

A string.

Description

Method; returns a string consisting of the characters between the points specified by the `from` and `to` parameters. If the `to` parameter is not specified, the end of the substring is the end of the string. If the value of `from` equals the value of `to`, the method returns an empty string. If the value of `from` is greater than the value of `to`, the parameters are automatically swapped before the function executes and the original value is unchanged.