5个版本 (3个重大更新)

0.7.0 2023年8月5日
0.6.0 2022年2月6日
0.5.0 2020年3月20日
0.4.1 2019年7月27日
0.4.0 2019年7月27日

#1407 in 文本处理


chars 中使用

MIT 许可协议

315KB
524

Cha(rs)

Build Status

使用此工具显示各种ASCII(和unicode)字符/代码点的名称和代码!

它深受ascii(1)的启发,但支持unicode字符;它也受到unicode.py的启发,但它试图更好地支持空白/控制字符。

Cha(rs) 目前可能在某些其他边缘情况下失败,但我希望不是。

发音

“chars”怎么发音?这是一个有争议的问题。

安装

此包已在circle CI上使用最新稳定版、beta版和nightly版进行测试。较旧版本可能可行,但我主要关注最新版本的开发。

不带源代码的平面crate安装

cargo install chars --git https://github.com/antifuchs/chars.git

操作系统包

Arch linux:有一个chars的AUR包

MacOS:有一个chars的Homebrew包

Windows:可以通过Chocolatey获取包。

源安装

  1. 克隆此仓库,
  2. cd 进入检出目录,
  3. cargoinstall --pathchars

运行

通过其面值查找字符

chars'ß'

截图

LATIN1 df, 223, 0xdf, 0337, bits 11011111
Width: 1 (2 in CJK context), prints as ß
Lower case. Upcases to SS
Quotes as \u{df}
Unicode name: LATIN SMALL LETTER SHARP S

通过Unicode点查找字符

chars U+1F63C

截图

U+0001F63C, 😼 0x0001F63C, \0373074, UTF-8: f0 9f 98 bc, UTF-16BE: d83dde3c
Width: 1, prints as 😼
Quotes as \u{1f63c}
Unicode name: CAT FACE WITH WRY SMILE

通过模糊的“char代码”查找字符

chars10

截图

U+0001F0EA, 🃪 0x0001F0EA, \0370352, UTF-8: f0 9f 83 aa, UTF-16BE: d83cdcea
Width: 1, prints as 🃪
Quotes as \u{1f0ea}
Unicode name: PLAYING CARD TRUMP-10

U+0001DAA9, 𝪩 0x0001DAA9, \0355251, UTF-8: f0 9d aa a9, UTF-16BE: d836dea9
Width: 0, prints as 𝪩
Quotes as \u{1daa9}
Unicode name: SIGNWRITING ROTATION MODIFIER-10

U+0001D209, 𝈉 0x0001D209, \0351011, UTF-8: f0 9d 88 89, UTF-16BE: d834de09
Width: 1, prints as 𝈉
Quotes as \u{1d209}
Unicode name: GREEK VOCAL NOTATION SYMBOL-10

U+0001D1A4, 𝆤 0x0001D1A4, \0350644, UTF-8: f0 9d 86 a4, UTF-16BE: d834dda4
Width: 1, prints as 𝆤
Quotes as \u{1d1a4}
Unicode name: MUSICAL SYMBOL ORNAMENT STROKE-10

U+FE09, ︉ 0xFE09, \0177011, UTF-8: ef b8 89, UTF-16BE: fe09
Width: 0, prints as ︉
Quotes as \u{fe09}
Unicode name: VARIATION SELECTOR-10

ASCII 1/0,  16, 0x10, 0020, bits 00010000
Control character; quotes as \u{10}, called ^P
Called: DLE
Also known as: Data Link Escape

ASCII 0/a,  10, 0x0a, 0012, bits 00001010
Control character; quotes as \n, called ^J
Called: LF, NL
Also known as: Line Feed, Newline, \n

ASCII 0/8,   8, 0x08, 0010, bits 00001000
Control character; quotes as \u{8}, called ^H
Called: BS
Also known as: Backspace, \b

ASCII 0/2,   2, 0x02, 0002, bits 00000010
Control character; quotes as \u{2}, called ^B
Called: STX
Also known as: Start of Text

查找控制字符

chars"^C"

截图

ASCII 0/3,   3, 0x03, 0003, bits 00000011
Control character; quotes as \u{3}, called ^C
Called: ETX
Also known as: End of Text

依赖

~5MB
~62K SLoC