dimanche 2 août 2015

Java - Ignore case checking user input

I need to check if the user input matches anything in a Set or List, but I am currently using .contains(). Obviously this is not working when the user inputs something that is not the correct case, so I was thinking of using .matches( regex ), but am not a professional regexer.

Would could I use Regex or Pattern to check if the user input matches anything in a List, case aside.

Thank you.

I did just notice that I will have to use a for-loop to get the elements out of my Set before comparing them with .matches().

Aucun commentaire:

Enregistrer un commentaire