WMLScript replaceAt() Function
The replaceAt() function divides the string into elements and replaces a specified element.
Syntax
n = String.replaceAt(string, substring, index, separator)
Component | Description |
---|---|
n | The string returned from the function. |
string | The original string. |
substring | The string to replace in the specified element of the string. |
index | An integer that specifies where to replace the substring. |
separator | Separator. |
Example
var a = String.replaceAt("Visit CodeW3C.com!","I love",0," "); var b = String.replaceAt("Visit CodeW3C.com!","us!",2," ");
Result
a = "I love CodeW3C.com!" b = "Visit us!"