Java 實例 - 字符串小寫轉(zhuǎn)大寫
以下實例使用了 String toUpperCase() 方法將字符串從小寫轉(zhuǎn)為大寫:
//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); } }
以上代碼實例輸出結(jié)果為:
Original String: string abc touppercase String changed to upper case: STRING ABC TOUPPERCASE
更多建議: