Let’s take a look at ASCII code table in binary.
A 1000001 a 1100001
B 1000010 b 1100010
C 1000011 c 1100011
...
Z 1011010 z 1111010
And 32 is 0100000
which is the only difference between lowercase and uppercase letters. So toggling that bit toggles the case of a letter.
More Related Contents:
- How to shift characters to ASCII values in a file based on user input c++ [closed]
- Determine if int is not 0 with no if statements
- Invalid solution for code challenge with operator restrictions
- How do you set, clear, and toggle a single bit?
- Best practices for circular shift (rotate) operations in C++
- Position of least significant bit that is set
- How to create a byte out of 8 bool values (and vice versa)?
- Examples of when a bitwise swap() is a bad idea?
- C/C++: Force Bit Field Order and Alignment
- What is the efficient way to count set bits at a position or lower?
- C/C++ check if one bit is set in, i.e. int variable
- Convert an int to ASCII character
- How do I set, clear, and toggle a single bit?
- In C/C++ what’s the simplest way to reverse the order of bits in a byte?
- Weird behavior of right shift operator (1 >> 32)
- Should I use #define, enum or const?
- How to add two numbers without using ++ or + or another arithmetic operator
- How to identify the file content as ASCII or binary
- get absolute value without using abs function nor if statement
- What happens when you bit shift beyond the end of a variable?
- What’s the fastest way to pack 32 0/1 values into the bits of a single 32-bit variable?
- Efficient bitwise operations for counting bits or find the right|left most ones
- Performance wise, how fast are Bitwise Operators vs. Normal Modulus?
- Branchless code that maps zero, negative, and positive to 0, 1, 2
- Are the character digits [‘0’..’9′] required to have contiguous numeric values?
- How to convert a string of hex values to a string?
- Fastest way to produce a mask with n ones starting at position i
- How to set, clear, and toggle a single bit?
- Fast divisibility tests (by 2,3,4,5,.., 16)?
- How can I test whether a number is a power of 2?