Can anyone tell me how to use a bitmask to convert uppercase letters to lowercase thank you
Can anyone tell me how to use a bitmask to convert uppercase letters to lowercase thank you
Try one of these:
tolower(int); I believe it is defined in types.h
or
char tolower(char in) {
if(in >= 'A' && in <= 'Z')
return in + 'a' - 'A';
else return in;
}
In the ASCII character set, upper case is before lower case, so the difference between the an upper case and its lower case counter part is 'a' - 'A'.
You can use a bit mask if necessary, but it will be a little more complicated. Think of how you would add and subtract two bits together using only boolean operators. I have done it in the past a bit at a time.
Do an OR operation on the uppercase letter with a bitmask of hex 20.
char bitmask = 0x20;
Thank you. I'll try that.