Java 实例 - 字符串小写转大写
@懂的都董 2017-10-19 05:51:42 以下实例使用了 String toUpperCase() 方法将字符串从小写转为大写:
//StringToUpperCaseEmp.java 文件public class StringToUpperCaseEmp {
public static void main(String[] args) {
String str = "string abc touppercase ";
String strUpper = str.toUpperCase();
System.out.println("Original String: " + str);
System.out.println("String changed to upper case: "
+ strUpper);
}}
以上代码实例输出结果为:
Original String: string abc touppercase
String changed to upper case: STRING ABC TOUPPERCASE