Simple user input capitalisation issue

How can I get a user's input, compare it to a string, and ignore any capitalisation differences between the two strings? I know the input bit, just the capitalisation bit im not sure about.
8 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @Zacurrya! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
noComment | Kez
noComment | Kez2mo ago
You can compare using .equalsIgnoreCase() ./run
String compareString = "thisISaSTRING";
String inputString = "THISisAstring";
if(compareString.equalsIgnoreCase(inputString)){
System.out.println("Yes!");
}
String compareString = "thisISaSTRING";
String inputString = "THISisAstring";
if(compareString.equalsIgnoreCase(inputString)){
System.out.println("Yes!");
}
I Run Code
I Run Code2mo ago
Here is your java(15.0.2) output @noComment | Kez
Yes!
Yes!
noComment | Kez
noComment | Kez2mo ago
Finally 😄 @Zacurrya see?
Zacurrya
ZacurryaOP2mo ago
thank God thats a convenient method
JavaBot
JavaBot2mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Zacurrya
ZacurryaOP2mo ago
thanks
JavaBot
JavaBot2mo ago
Post Closed
This post has been closed by <@447045043270844416>.
Want results from more Discord servers?
Add your server