Use bitwise operators to convert characters to uppercase/lowercase. Bitwise AND with 95 (or '_'
) to convert to uppercase, bitwise OR with 32 (or ''
) to convert to lowercase, and to invert case, bitwise XOR with 32 (or ''
).
This only works for letters, and it also seems to work for just a few other characters: {
and }
are lowercase for [
and ]
, ~
and `
are lowercase for ^
and @
, )
is lowercase for a tab, and *
is lowercase for a newline.