Can I use the equals operator to match a case-sensitive String
that contains underscore?
str1.trim() == "Aavik_aArjun"
Or should I use a regex for this simple match as the equals operator is not working?
Can I use the equals operator to match a case-sensitive String
that contains underscore?
str1.trim() == "Aavik_aArjun"
Or should I use a regex for this simple match as the equals operator is not working?
For String
(and objects in general) use the .equals() method and not the ==
operator, as the former compares the references and not the actual content of the Strings.