|
Newsletters
|
|
|
|
|
WMLScript Reference
WMLScript Reference
WMLScript > String > subString()
subString() - The subString Function
Usage: subString(string, startIndex, length)
Description: Returns a new string that is a substring of the given string. The substring begins at the specified startIndex and its length (number of characters) is the given length. If the startIndex is less than 0 then 0 is used for the startIndex. If the length is larger than the remaining number of characters in the string, the length is replaced with the number of remaining characters.
If the startIndex or the length is of type floating-point, Float.int() is first used to calculate the actual integer value.
Example:var a = "ABCD";
var b = String.subString(a, 1, 2); // b = "BC"
var c = String.subString(a, 2, 5); // c = "CD"
var d = String.subString(1234, 0, 2); // d = "12"
Bookmark this page
|
|