Reputation: 41
Is there an elegant way to treat both lower- and uppercase characters the same ?
Something where
if (char == a)
Would return true regardless of char being A
or a
.
Upvotes: 0
Views: 147
Reputation: 44125
Just convert it to uppercase or lowercase first:
if (char.toUpperCase() == "A") {...}
// Or
if (char.toLowerCase() == "a") {...}
Upvotes: 1