Java String toUpperCase() 方法
实例
将字符串转换为大写和小写字母:
public class Main {public static void main(String[] args) {String txt = "Hello World";System.out.println(txt.toUpperCase());System.out.println(txt.toLowerCase());}}
定义与用法
toUpperCase() 方法将字符串转换为大写字母。
注意:toLowerCase() 方法将字符串转换为小写字母。
语法
参数
无
技术细节
| 返回: | 一个 String 值,表示转换为大写的新字符串 |
|---|