1、在你的项目中引入hutool的jar包

2、定义两个需要对比的字符串

3、在定义一个布尔值,true代表null值是否排在前

4、int compare = StrUtil.compareIgnoreCase(str1, str2, nullIsLess);//忽略大小写进行对比

5、运行程序查看得到的结果值

时间:2024-10-13 14:36:00
1、在你的项目中引入hutool的jar包
2、定义两个需要对比的字符串
3、在定义一个布尔值,true代表null值是否排在前
4、int compare = StrUtil.compareIgnoreCase(str1, str2, nullIsLess);//忽略大小写进行对比
5、运行程序查看得到的结果值