【发布时间】:2025-11-28 07:45:01
【问题描述】:
skdoakdoakdoakdpoakdpoakdopkapodkoapdkpoakdpoakdpakpdkapdkpaodkpakdpakdpakdpkpdkadpkapdkpaoooooooooooooooooooooooooooooooooooooooooooooooo dksaodaoddddddddddddddddddddddddddddddddddkaopdkpadpaokdakdopakdpakpda dksaopdoapkdpakdpoakdpokdkapodpadpakdpoakdopakdopkpoakdpapdkapdpada kdposaodpadpakdopakdpoakdpokpdkpakdopadkpakdkdkpadkakdpakdp
String test1 = "java java java. JAVA! ";
String test2 = "h w !!! ...";
String word ="java";
int count = 0;
String strArray[] = test2.split(" ");
for(int i=0; i < strArray.length; i++){
if (word.equals("java")) {
`enter code here`
count++;
}
System.out.println(strArray[i]);
}
System.out.println(count);
test1.toUpperCase() + test1.toLowerCase().concat;
count++;
test1.toLowerCase();
count++;
System.out.println(count);
如何在 java 中返回不区分大小写的 java 中的出现我会在互联网上拖钓,但没有运气。在 JavaScript 中我会使用 are 但在这里我是新的所以请帮忙。所以我需要按照上面的建议找到java不区分大小写的次数
【问题讨论】:
-
看看这是否有帮助.. *.com/questions/767759/….只改变“lastIndex = str.indexOf(findStr,lastIndex);”到“lastIndex = str.toLowerCase().indexOf(findStr,lastIndex);”
标签: java string comparison case-insensitive