155k views
0 votes
What bit position in an ascii code must be complemented to change the ascii letter represented from uppercase to lowercase and vice versa?

User Okeen
by
8.1k points

1 Answer

7 votes
Flip bit position 5 to accomplish this. This maps to hex value 0x20, where the least significant bit is assumed to be at position 0.

Example: ascii "A" = 0x41, "a" = 0x61. 0x41 xor 0x61 = 0x20.

You would implement a flip function by XOR'ing the character value with 0x20.
User Bigtv
by
8.9k points