概要
Javaで「文字列に含まれる文字を大文字または小文字に変換する」の動作を確認してみました。
以下のページを参考にしました。
実装
以下のファイルを作成しました。
JSample14_1.java
class JSample14_1{
public static void main(String[] args){
String str1 = "TeaCup";
String str2 = "Mouse";
System.out.println(str1);
System.out.println(str1.toUpperCase());
System.out.println(str1.toLowerCase());
System.out.println(str2);
System.out.println(str2.toUpperCase());
System.out.println(str2.toLowerCase());
}
}
以下のコマンドを実行しました。
$ javac JSample14_1.java
$ java JSample14_1
TeaCup
TEACUP
teacup
Mouse
MOUSE
mouse
まとめ
何かの役に立てばと。