upperCase()

strLib.upperCase() 関数は、文字型の値のコピーを返し、そのコピー内のすべての大文字を小文字に設定します。数値は影響を受けません。

入力値が String 型以外の場合、データ変換機構は入力値から末尾ブランクを除去します。末尾ブランクを保持するには、代わりに strLib.upperCaseChar() 関数を使用します。

文字ストリングを小文字に変換するには、strLib.lowerCase() 関数または strLib.lowerCaseChar() 関数を使用します。

構文

  strLib.upperCase(
    text STRING? in)
  returns (result STRING?)
text
STRING 型と代入互換性のある任意の変数または式を入力できます (『EGL における代入互換性』を参照)。
result
STRING 型の変数。text が NULL の場合、関数は NULL 値を戻します。

以下のコードについて考えてみます。
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
出力は以下のとおりです。
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

末尾ブランクの除去は、非 String 文字型から String 文字型へのデータ変換中に発生します。この変換は、strLib.upperCase() 関数を実行する前に発生します。

互換性

表 1. upperCase の互換性に関する考慮事項
プラットフォーム 問題
COBOL 生成 strLib.upperCase() 関数は、2 バイト文字に対しては無効です。

フィードバック