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