substring()

可用性

Flash Lite 1.0。

用法

substring(string, index, count) 

Operands

string 从中提取新字符串的字符串。

index 要提取的第一个字符的编号。

count 要包含在所提取字符串中的字符的数目,其中不包括 index 处的字符。

说明

函数;提取部分字符串。此函数是从 1 开始的,而 String 类方法是从 0 开始的。

示例

以下示例从字符串"Hello World"中提取前五个字符:

origString = "Hello World!";
newString = substring(origString, 0, 5);
trace (newString);            // 输出:Hello