|
Newsletters
|
|
|
|
|
WMLScript Reference
WMLScript Reference
WMLScript > String > replaceAt()
replaceAt() - The replaceAt Function
Usage: replaceAt(string, element, index, separator)
Description: Returns a new string with the current element at the specified index replaced with the given element. If the index is less than 0 then the first element is replaced. If the index is larger than the number of elements then the last element is replaced. If the string is empty, the function returns a new empty string with the given element.
If the index is of type floating-poing, Float.int() is first used to calculate the actual index value.
Example:var a = "B C; E";
var s = " ";
var b = String.replaceAt(a, "A", 0, s); // b = "A C; E"
var c = String.replaceAt(a, "F", 5, ";"); // c = "B C;F"
Bookmark this page
|
|