Make .equals() NOT case sensitive

0 Super Mufasa · October 24, 2014
Ok, basically I'm checking if two Strings are the same, like this:


But, there's one problem: If string1 isn't spelled all lower case, it won't work. Since I don't want to have to make a .equals() for each different combination of lower and upper case letters, I wanted to know if there's a way to make this not case-sensitive.


Post a Reply


Oldest  Newest  Rating
+1 Alex Sweps · October 24, 2014
I never knew about that method Ismael, thanks :)
0 Super Mufasa · October 25, 2014
@Ismael Vazquez 
Thanks! It worked! +1
0 Developer John · October 25, 2014
You didn't Alex?:wassat::sideways:
0 Alex Sweps · October 26, 2014
Lol nope :P Usually for upper and lower case stuff I force the input to convert to upper and then just use .equals as normal. I havent had to do that much so didnt really notice that method in the dropdown list...

This is how iv been doing it lol:

input = getInput.toUpperCase();
+1 Pere Garau Burguera · November 1, 2014
There is already a method for that.


0 Developer John · November 1, 2014
I think we knew that already XD
+1 Pere Garau Burguera · November 1, 2014
The thing is that I can't see what Ismael posted. 
0 Developer John · November 2, 2014
Now, what if I wanted to check multiple variables if they're equal to strings that aren't case sensitive. What would I input for code? Would I spam or operators? 
0 Developer John · November 2, 2014
That's what I meant by spamming or operators lol
0 Super Mufasa · November 3, 2014
@Pere me neither, I think he removed his reply. idk why :P
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator