Replaces contents of a string with the value provided to itat position specified.
Parameters
- Character or string value to replace
- Start Starting position to replace (Optional)optional) - the first character is considered position 1; if omitted, defaults to position 1
- Length to replace (Optional)optional) - if omitted, the rest of the string is replaced
Example
|
code |
pjs.define("myString", { type: 'char', length: 11, initValue: 'Windsor, ON' });
myString = myString.replaceString('Toronto');
return myString;
// "Toronto, ON" |
|
pjs.define("myString", { type: 'char', length: 12, initValue: 'Lancaster, PA' });
myString = myString.replaceString('CA', 11);
return myString;
// "Lancaster, CA" |
RPG Equivalent
%REPLACE()