|
Newsletters
|
|
|
|
|
WMLScript Reference
WMLScript Reference
WMLScript > String > elementAt()
elementAt() - The elementAt Function
Usage: elementAt(string, index, separator)
Description: Search string for index'th element, elements being separated by the first character in separator and return the corresponding element. If the index is less than 0 then the first element is returned. If the index is larger than the number of elements then the last element is returned. If the string is an empty string then an empty string is returned.
If the index is of type floating-point, Float.int() is first used to calculate the actual index value.
Example:var a = "My name is Joe; Age 50;";
var b = String.elementAt(a, 0, " "); // b = "My"
var c = String.elementAt(a, 14, ";"); // c = ""
var d = String.elementAt(a, 1, ";"); // d = " Age 50"
Bookmark this page
|
|