WMLScript replace() Function

The replace() function replaces a part of the string with a new string and returns the result.

Syntax

n = String.replace(string, oldvalue, newvalue)
Component Description
n The string returned from the function.
string Original string.
oldvalue The value to be replaced.
newvalue Replace the value of oldvalue.

Example

var a = String.replace("world","wor","bo");
var b = String.replace("world", "ld","ry");

Result

a = "bold"
b = "worry"