string.translate()



Translates characters in a string according to the From and To parameters, which hold a string of characters to translate. 

Parameters
  1. From - String of characters to look for

  2. To - Corresponding string of characters to replace From characters with

  3. Start position (optional) - the first character is considered position 1; if omitted, the entire string is processed



const Upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' const Lower = 'abcdefghijklmnopqrstuvwxyz' pjs.define('myString', { type: 'char', length: 15, initValue: 'MYSTRING'}); myString = myString.translate(Upper, Lower); return myString; // 'mystring'

RPG Equivalent

%XLATE(), XLATE