American Standard Code for Information Interchange is an encoding system used to represent characters in a numerical form.
The range of characters are separated into the following four quarters: (0x00 - 0x1f) - Contains All Control, Non Printing Characters (0x20 - 0x3f) - Contains The Numerals 0-9 (0x40 - 0x5F) - Contains The Lowercase Characters (0x60 - 0x7F) - Contains The Uppercase Characters Punctuation is places in unused spaces in the above pattern.
Control characters are non-printable characters used for communication, control signaling, and formating. The control characters occupy the range 0x00 - 0x1F.
The numerals 0 through 9 occupy 10 spaces in this range. Numerals are encoded as 0x3N, where N is the numeral being encoded. The numerals have a value ranging from 0x30 - 0x39.
The uppercase letters A through Z are represented by the range 0x41 - 0x5A.
The lowercase letters a through z are represented by the range 0x61 - 0x7A.
Lowercase to Uppercase
All uppercase characters contain a 1 in the 5th bit. Preforming a logical OR operation on a character with 0x20 will make the character uppercase.
Uppercase to Lowercase
All lowercase characters contain a 0 in the 5th bit. Preforming a logical AND operation on a character with 0xDF will make the character lowercase.
Flip The Case
To simply flip the case of a character, XOR the character with 0x20
This page is an Article on bildr. Articles are pages that define or explain a concept, method, or generic item.