Home  >  Article  >  What is the general basis for comparing the sizes of alphabetic characters in computers?

What is the general basis for comparing the sizes of alphabetic characters in computers?

青灯夜游
青灯夜游Original
2021-10-25 11:34:2913259browse

The size comparison of alphabetic characters in computers is generally based on "ASCII code". Alphabetic character comparison refers to the operation of comparing the size of a single character or string in dictionary order. Generally, the size of the ASCII code value is used as the standard for character comparison.

What is the general basis for comparing the sizes of alphabetic characters in computers?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

In microcomputers, character comparison refers to the operation of comparing the size of a single character or string in dictionary order. Generally, the size of the ASCII code value is used as the character comparison. standard.

If the ASCII code value of a certain character is greater than the ASCII code of another character, the previous character is considered to be "greater" than the following character, such as "C" is greater than "A".

characters generally use the internationally accepted ASCII character set. Each character is represented internally by the computer as an 8-bit binary code. BASIC stipulates that the comparison of two single characters is to compare their code values. For example: In the ASCII character table, the code value of "A" is 65 (decimal number), and the code value of "B" is 66 (decimal number), so "A" is smaller than "B". When the operation "A" < "B",, the result is true; when the operation "A" - "B", the result is false.

The ASCII character set and its code values ​​are detailed in the attached table .The general rule is: the space code value is the smallest; the numeric code value is smaller than the code value of letters. In numeric codes, the code value of 0 is the smallest, and the code value of 9 is the largest. In letters, the size of the code value increases in alphabetical order.

The order of character sizes can be arranged from small to large using the following table:

Space! ” # $ % & ' (

) *, 1. 0 1 2 3

4 5 6 7 8 9 : ; <=

> ? @ A B C D E F G

H I J K L M N O P Q

R S T U V W

For more related knowledge, please visit the

FAQ column!

The above is the detailed content of What is the general basis for comparing the sizes of alphabetic characters in computers?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn