Java中如何对字符串中的字母进行大小写转换?
1、“小写字母”转换为“大写字母”——toUpperCase()
String s1 = "abcdefg,HiJkLmn";
System.out.println(s1.toUpperCase());//ABCDEFG,HIJKLMN
String s2 = "hello world,你好啊AA,1oqa世界a";
System.out.println(s2.toUpperCase());//HELLO WORLD,你好啊AA,1OQA世界A
2、“大写字母”转换为“小写字母”——toLowerCase()
String s1 = "ABCDefgHiJkLMN";
System.out.println(s1.toLowerCase());//abcdefghijklmn
String s2 = "HELLO WORLD,你好啊AA,1oqa世界a";
System.out.println(s2.toLowerCase());//hello world,你好啊aa,1oqa世界a