字符串小写转大写

字符串小写转大写

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 StringRegionMatch {//测试两个字符串区域是否相等

public static void main(String[] args) {

String first_str = "Welcome to Microsoft";

    String second_str = "I work with microsoft";

    boolean match1 = first_str.

    regionMatches(11, second_str, 12, 9);

    boolean match2 = first_str.

    regionMatches(true, 11, second_str, 12, 9); //第一个参数 true 表示忽略大小写区别

    System.out.println("区分大小写返回值:" + match1);

    System.out.println("不区分大小写返回值:" + match2);

}

}

 

posted @ 2021-10-13 22:15  慢漫曼蔓  阅读(322)  评论(0)    收藏  举报