> 文章列表 > 大小字母转换

大小字母转换

大小字母转换

1.代码实例:

public class UpString {
public static void main(String[] args) {
if(args!=null && args.length == 1){
String str = new String(args[0]);
System.out.println(“原字符:” + str + “\\n”);
String newA = str.toUpperCase();
System.out.println(“大写转换:” + newA);
}
}
}

public class LowString {
public static void main(String[] args) {
if(args!=null && args.length == 1){
String str = new String(args[0]);
System.out.println(“原字符串:” + str + “\\n”);
String newB = str.toLowerCase();
System.out.println(“小写转换:”+ newB);
}
}
}

实现案例:
大小字母转换大小字母转换