Rexx Programming/How to Rexx/case conversion

The rexx scripting language does not provide dedicated functions for converting strings to uppercase or to lowercase. However, there are solutions available:

Converting a string to uppercaseEdit

If the translate function is used with only one argument is used, it will convert all alphabetical characters in a string to uppercase:

mystring="I want to go to the BIG APPLE"
ustring = translate(mystring)
say ustring

Converting a string to lowercaseEdit

Conversion to lowercase lettering is a bit more tricky, because there is no dedicated inbuilt function for lowercase conversion. In order to translate a string into lowercase, it is necessary to provide a set of uppercase and lowercase letters, and use the translate function to perform conversion:

upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lower = 'abcdefghijklmnopqrstuvwxyz'
mystring="I want to go to the BIG APPLE"
lstring = translate(mystring, lower, upper)
say lstring
Last modified on 22 June 2011, at 14:28