I have a simple question. How to make index case insensitive in java. This question has already been answered, but I did not understand the answer.
Say, for example, I have the line s = Phone (Conf) I want to pull an entry that has (Conf) like this, but users enter CONF or conf or Conf, etc. Therefore, my program should be able to pull out the entry if it finds the word conf anyway.
if(s.indexOf("(")>-1&& s.indexOf("Conf")>-4 && s.lastIndexOf(")")>-1) { String s1=s.substring(s.indexOf("(Conf"),s.lastIndexOf(")")+1); }
Can someone explain me pls? The above code pulls it, if only the line is (Conf).
java indexof
javalearner
source share