Page tree
Skip to end of metadata
Go to start of metadata

The string.scanReplace() API allows you to find and replace a string within another string.

  1. Value - value to find
  2. Replace with - value to replace with
  3. 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
  4. Length to search (optional) - if omitted, the rest of the string is searched
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.'