next up previous contents
Next: toLowerCase Up: Methods Previous: substr   Contents


substring

Description
Retrieves the substring at the specified location within a String object.


Syntax

  1. StringObj.substring(from, to)
  2. "String Literal".substring(from, to)


Parameters

from
An integer that indicates the position of the first character of StringObj 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 StringObj 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

The substring method returns a String object containing the substring derived from the original object. If from is not an integer, it returns an empty string. If from is greater than or equal to to, it also returns an empty string.


Example

s = "Hello world";
r = s.substring(6, 11);
trace(r);
//output: world



next up previous contents
Next: toLowerCase Up: Methods Previous: substr   Contents
Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.