upperCase()

The strLib.upperCase() function returns a copy of a character-type value and sets all the uppercase characters in that copy to lowercase. Numeric values are not affected.

If the input value is of a type other than String, a data conversion strips trailing blanks from the input value. To retain trailing blanks, use the strLib.upperCaseChar() function instead.

To convert a character string to lowercase, use the strLib.lowerCase() or strLib.lowerCaseChar() function.

Syntax

  strLib.upperCase(
    text STRING? in)
  returns (result STRING?)
text
Input can be any variable or expression that is assignment compatible with the STRING type (see "Assignment compatibility in EGL").
result
A variable of type STRING. If text is null, the function returns a null value.

Example

Consider the following code:
function main()

   // each of the literals has 8 characters 
		myChar CHAR(5)       = "abc     "; 
		myUnicode UNICODE(5) = "abc     ";
		myString String      = "abc     ";
		
   sysLib.writeStdout(StrLib.upperCase(myChar) + 
      "is, for upperCase type Char");
   sysLib.writeStdout(StrLib.upperCaseChar(myChar) + 
      "is, for upperCaseChar type Char");
   sysLib.writeStdout(StrLib.upperCase(myUnicode) + 
      "is, for upperCase type Unicode");
   sysLib.writeStdout(StrLib.upperCaseChar(myUnicode) + 
      "is, for upperCaseChar type Unicode");		
		sysLib.writeStdout(StrLib.upperCase(myString) + 
      "is, for upperCase type String");
   sysLib.writeStdout(StrLib.upperCaseChar(myString) + 
      "is, for upperCaseChar type String");

end
The output is as follows:
ABCis, for upperCase type Char
ABC  is, for upperCaseChar type Char
ABCis, for upperCase type Unicode
ABC  is, for upperCaseChar type Unicode
ABC     is, for upperCase type String
ABC     is, for upperCaseChar type String

The stripping of trailing blanks occurs during a data conversion from a non-String character type to a String. That conversion occurs before the strLib.upperCase() function runs.

Compatibility

Table 1. Compatibility considerations for upperCase
Platform Issue
COBOL generation The strLib.upperCase() function has no effect on double-byte characters.

Feedback