Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Note
titleContent Freeze

As of July 25th, 2023, there is a content freeze on this page.

Replaces contents of a string with the value provided at position specified. 

Parameters
  1. Character or string value to replace
  2. Starting position to replace (optional) - the first character is considered position 1; if omitted, defaults to position 1
  3. Length to replace (optional) - if omitted, the rest of the string is replaced
Example


Code Block
languagejavascript
pjs.define("myString", { type: 'char', length: 11, initValue: 'Windsor, ON' });

myString = myString.replaceString('Toronto');

return myString;
// "Toronto, ON"



Code Block
languagejavascript
pjs.define("myString", { type: 'char', length: 12, initValue: 'Lancaster, PA' });

myString = myString.replaceString('CA', 11);
 
return myString;
// "Lancaster, CA"

RPG Equivalent

%REPLACE()