String Library Functions
There are 16 string functions included in the String library, allowing you to do everything from counting the elements in an array to finding and replacing all occurances of substrings. I've included full descriptions here only of the functions used in my examples. For a complete listing of the functions, see the WMLScript Standard Libraries Specification and start reading on page 23.
- elementAt
- Syntax: String.elementAt(string, index, separator);
Returns the indexth element of the array string, where each element in the array is separated by separator.
- replaceAt
- Syntax: String.replaceAt(string, index, separator);
Returns the indexth element of the array string, where each element in the array is separated by separator.
- format
- Syntax: String.format(format, value);
Converts value to a string with format specified by format. format has the form:
% [width] [.precision] type
where:
- width specifies the minimum number of characters printed
- precision depends on type
- type can be "d" for integer output, "f" for floating point output, or "s" for string.