Commit 68d4b88e authored by Giant's avatar Giant
Browse files

Fix bug in StartsWithAny causing incorrect sending of a position if no match found.

parent a0689ec7
......@@ -77,27 +77,37 @@ public class Misc {
public static int startsWithAny(String needle, String... haystack) {
int i = -1;
boolean matchFound = false;
for(String straw : haystack) {
++i;
if(needle.startsWith(straw)) {
matchFound = true;
break;
}
}
if(!matchFound)
i = -1;
return i;
}
public static int startsWithAnyIgnoreCase(String needle, String... haystack) {
int i = -1;
boolean matchFound = false;
for(String straw : haystack) {
++i;
if(needle.toLowerCase().startsWith(straw.toLowerCase())) {
matchFound = true;
break;
}
}
if(!matchFound)
i = -1;
return i;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment