Java字符串大小写转换的方法有以下几种:
String str = "hello";
String upperCaseStr = str.toUpperCase();
System.out.println(upperCaseStr); // 输出: HELLO
String str = "HELLO";
String lowerCaseStr = str.toLowerCase();
System.out.println(lowerCaseStr); // 输出: hello
String str = "hello";
char ch = str.charAt(0);
char upperCaseCh = Character.toUpperCase(ch);
System.out.println(upperCaseCh); // 输出: H
String str = "HELLO";
char ch = str.charAt(0);
char lowerCaseCh = Character.toLowerCase(ch);
System.out.println(lowerCaseCh); // 输出: h
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: java手动提交事务和自动提交怎么设置