ASCII

From bildr

Jump to: navigation, search

American Standard Code for Information Interchange is an encoding system used to represent characters in a numerical form.

Contents

Character Encoding

ASCII is a 7 bit code utilizing the 7 least significant bits of a byte with the most significant bit being set to zero. There are 128 possible characters in standard ASCII.

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

Control characters are non-printable characters used for communication, control signaling, and formating. The control characters occupy the range 0x00 - 0x1F.

Numerals

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.

Case

Uppercase Letters
The uppercase letters A through Z are represented by the range 0x41 - 0x5A.

Lowercase Letters
The lowercase letters a through z are represented by the range 0x61 - 0x7A.

Case Conversion

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.

NOTE: All information contained within this article is pure opinion. Although this article is intended to help people, it may contain faulty or misleading information. This article is not to be considered professional opinion or advice, and is in no way a replacement for reading all safety/instructional documentation. Always remember to protect yourself when handling/using hazardous materials, as well as test new techniques before using them on projects/work intended to be handed in or used.

bildr and its contributers take NO responsibility for the information contained within.