replace

Replace occurrences of from with to in subject in a new array.

Parameters

subject E[]

the array to scan

from R1

the item to replace

to R2

the item to replace all instances of from with

Return Value

Type: E[]

A new array without changing the contents of subject, or the original array if no match is found.

Examples

assert("Hello Wörld".replace("o Wö", "o Wo") == "Hello World");
assert("Hello Wörld".replace("l", "h") == "Hehho Wörhd");

See Also

Meta