Java字符串大小写转换。

小写转大写:toUpperCase()

大写转小写:toLowerCase() 

public class HelloWorld {
    public static void main(String []args) {
        
        
        String STR="abcdefg";
            String STR1=STR.toUpperCase();  //toUpperCase() 小写转大写
            
       System.out.println("STR小写转大写:"+STR1);
        
        String str="ABCDEFG";
            String str1=str.toLowerCase();  //toLowerCase()   大写转小写
            
       System.out.println("str大写转小写:"+str1);
        
        
    }
}


版权声明:本文为QQ675396947原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。