版权声明:wangchong https://blog.csdn.net/wfcn_zyq/article/details/89785334
有时候我们需要忽略大小写比较两个字符串是否相等
使用String类中的函数
样例
package www.wangchong.study;
/**
* @author wangchong
* @date 2019/5/3 10:15
* @email [email protected]
* @CSDN https://blog.csdn.net/wfcn_zyq
* @describe
*/
public class IgnoreUpperLowerCase {
public static void main(String[] args) {
String a = "ABC";
String b = "abc";
System.out.println(a.equalsIgnoreCase(b));
}
}
输出
具体应用在下一篇博客中,欢迎学习