mercredi 31 juillet 2019

Handling letter cases in c#

In my program I'm using an if-statement to check if a character from a string is a letter or not. I'm using the following if-statement:

if (('A'<= character && character >= 'Z') || ('a' <= character && character >= 'z'))

The if-statement, as far as I know is true for all lower case letters and true for all upper case letters. I want it to be true for all letters. I'm not sure how character codes work in c#, could that be why it's not working?

Aucun commentaire:

Enregistrer un commentaire