ASCII 码是什么?常用字符对照表

一、什么是 ASCII 码

ASCII(American Standard Code for Information Interchange)是美国信息交换标准代码。它使用 7 位二进制数(0-127)来表示 128 个字符,包括英文字母、数字、标点符号和控制字符。

二、ASCII 码分类

  • 控制字符(0-31 和 127):不可打印字符,用于控制设备操作
  • 可打印字符(32-126):包括空格、数字、字母、标点符号等

三、常用 ASCII 字符速查表

  • 数字 0-9:十进制 48-57
  • 大写字母 A-Z:十进制 65-90
  • 小写字母 a-z:十进制 97-122
  • 空格:十进制 32
  • 换行符:十进制 10
  • 回车符:十进制 13

四、程序员必须熟记的特殊字符

  • \n (10): 换行符
  • \r (13): 回车符
  • \t (9): 水平制表符
  • \0 (0): 空字符
  • ^ (94): 脱字符
  • _ (95): 下划线

五、ASCII 码的应用场景

  • 文本文件编码
  • 字符比较和排序
  • 密码验证(如检查是否包含数字/字母)
  • 串口通信协议
🔧 查看完整 ASCII 码表

What is ASCII? Character Codes Reference

I. What is ASCII

ASCII (American Standard Code for Information Interchange) is a character encoding standard. It uses 7-bit binary numbers (0-127) to represent 128 characters, including English letters, digits, punctuation marks, and control characters.

II. ASCII Code Categories

  • Control Characters (0-31 and 127): Non-printable characters used for device control
  • Printable Characters (32-126): Includes space, digits, letters, and punctuation

III. Common ASCII Characters Quick Reference

  • Digits 0-9: Decimal 48-57
  • Uppercase A-Z: Decimal 65-90
  • Lowercase a-z: Decimal 97-122
  • Space: Decimal 32
  • Newline: Decimal 10
  • Carriage Return: Decimal 13

IV. Essential Special Characters for Programmers

  • \n (10): Newline
  • \r (13): Carriage return
  • \t (9): Horizontal tab
  • \0 (0): Null character
  • ^ (94): Caret
  • _ (95): Underscore

V. ASCII Applications

  • Text file encoding
  • Character comparison and sorting
  • Password validation
  • Serial communication protocols
🔧 View Complete ASCII Table