%XLATE(from:to:string{:startpos})
%XLATE translates string according to the values of from, to, and startpos.
- The first parameter contains a list of characters that should be replaced
- The second parameter contains their replacements.
- The third parameter is the string to be translated.
- The fourth parameter is the starting position for translation.
- By default, translation starts at position 1.
Sample RPGLE program to convert String from lowercase to uppercase and from uppercase to lowercase
d lowerCase c 'abcdefghijklmnopqrstuvwxyz' d upperCase c 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' d inputString s 50a d outputString s 50a /free inputString = 'Convert from lowerCase to upperCase'; outputString = %xlate(lowercase:uppercase:inputString); dsply outputString; //CONVERT FROM LOWERCASE TO UPPERCASE inputString = 'CONVERT FROM UPPERCASE TO LOWERCASE'; outputString = %xlate(uppercase:lowercase:inputString); dsply outputString; //convert from uppercase to lowercase *inlr = *on; return; /end-free
No comments:
Post a Comment
NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.