Commit 96e77c8b authored by Giant's avatar Giant
Browse files

Implement ability to check if needle starts with any entry in haystack.

parent efcf138c
......@@ -75,6 +75,32 @@ public class Misc {
return false;
}
public static int startsWithAny(String needle, String... haystack) {
int i = -1;
for(String straw : haystack) {
++i;
if(needle.startsWith(straw)) {
break;
}
}
return i;
}
public static int startsWithAnyIgnoreCase(String needle, String... haystack) {
int i = -1;
for(String straw : haystack) {
++i;
if(needle.toLowerCase().startsWith(straw.toLowerCase())) {
break;
}
}
return i;
}
public static Boolean contains(List<String> haystack, String needle) {
for(String hay : haystack) {
hay = hay.replace("[", "");
......
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