Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Rexx Programming/How to Rexx/case conversion

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

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 uppercase 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 lowercase 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 Converting a string using PIPE If the PIPE commands are available, there is a stage called XLATE which can provide case conversion. name = 'eric' 'PIPE VAR name | XLATE UPPER | VAR name' SAY name Shows 'ERIC' name = 'ERIC' 'PIPE VAR name | XLATE LOWER | VAR name' SAY name Shows 'eric' name = 'eric' 'PIPE VAR name | XLATE 1 UPPER | VAR name' SAY name Shows 'Eric' name = 'ERIC' 'PIPE VAR name | XLATE 2-4 LOWER | VAR name' SAY name Shows 'Eric'