How can I tell if the substring "template" (for example) exists inside a String object?
It would be great if it was not a case-sensitive check.
String.indexOf(String)
For a case insensitive search, to toUpperCase or toLowerCase on both the original string and the substring before the indexOf
String full = "my template string";
String sub = "Template";
boolean fullContainsSub = full.toUpperCase().indexOf(sub.toUpperCase()) != -1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With