The best way is to use str. equalsIgnoreCase(“foo”) . It’s optimized specifically for this purpose. You can also convert both strings to upper- or lowercase before comparing them with equals .
The best way is to use str. equalsIgnoreCase(“foo”) . It’s optimized specifically for this purpose. You can also convert both strings to upper- or lowercase before comparing them with equals .