string.scanReplace()
The string.scanReplace() API allows you to find and replace a string within another string.
Parameters
Value - value to find
Replace with - value to replace with
Index (optional) - start scan from this index; the first character in the string is considered index 1; if omitted, the search starts from the beginning of the string
Length to search (optional) - if omitted, the rest of the string is searched
Example
pjs.define("string1", { type: 'char', length: 100, varying: true });
Â
string1 = 'See NAME. See NAME run. Run NAME run.';
Â
string1 = string1.scanReplace('NAME', 'Tom');
Â
return string1;
// 'See Tom. See Tom run. Run Tom run.'