= ASC( string )
The ASC
command performs a very specific function: it converts the first
character of a string into its corresponding ASCII code. ASCII stands for
American Standard Code for Information Interchange and it is a standard
encoding that associates each alphanumeric character and many symbols
with an integer between 0 and 127. This number represents the internal
representation of the character within the computer.
The ASC
command allows you to manipulate the individual characters
of a string numerically. For example, you can check whether a character
is an uppercase letter (its ASCII code will be between 65 and 90), or whether
it is a number (its ASCII code will be between 48 and 57).
Comparing the ASCII codes of two characters is an efficient way to establish
the alphabetical order between them and, in some applications, you need to
convert characters to numbers or vice versa. ASC
is a fundamental tool
for this type of operation.
In 8-bit computers, memory is organized in bytes, which are sequences of
8 bits. Each byte can represent a number from 0 to 255. Since ASCII
encoding uses only 7 bits, a byte can represent 128 different characters.
On 8-bit computers, the supported character set is limited to 128 ASCII
characters. This means that accented characters or characters from other
languages cannot be directly represented. The exact meaning of an ASCII
code can vary slightly depending on the encoding used. Note that the CHR$
command is the inverse of ASC
, it converts an ASCII code to a character.
Ax
If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!