Java 实例 - 字符串小写转大写与小写转大写


public class StringToUpperCaseEmp {
    public static void main(String[] args) {
        String str = "string runoob";
        String strUpper = str.toUpperCase();
        System.out.println("原始字符串: " + str);
        System.out.println("转换为大写: " + strUpper);
    }
}

public class StringToUpperCaseEmp {
    public static void main(String[] args) {
        String str = "STRING RUNOOB";
        String strLower = str.toLowerCase();
        System.out.println("原始字符串: " + str);
        System.out.println("转换为小写: " + strLower);
    }
}

猜你喜欢

转载自blog.csdn.net/qq_43751200/article/details/107488991