0

When I use if/else I want the if to be case-insensitive. So instead of having to type "What's Up", "what's up", "What's up", "What's UP", et cetera, I can make it case insensitive and only use one variation of "what's up".

Yu Hao
  • 115,525
  • 42
  • 225
  • 281

2 Answers2

2

Convert the string to lower case (or upper case), and then compare:

>>> s = "What's Up"
>>> s.lower() == "What's up".lower()
True
Yu Hao
  • 115,525
  • 42
  • 225
  • 281
0

In any language, just make the text entered to be lowercase first and then compare it in the if/else block.

In java, you can store the value in a string and use the equalsIgnoreCase() method to compare values in if/else block.

Go to this link: equalsIgnoreCase

Search for equalsIgnoreCase() method on this page

Check below link:

case insensitive String comparison for Python

Hope this helps