#utf-8 #width #character #unicode-width #unicode-characters #length

no-std utf8-width

To determine the width of a UTF-8 character by providing its first byte

8 releases

0.1.7 Nov 20, 2023
0.1.6 Mar 19, 2022
0.1.5 Apr 22, 2021
0.1.4 Jul 29, 2020
0.1.3 Jun 27, 2020

#152 in Encoding

Download history 165727/week @ 2024-10-24 175541/week @ 2024-10-31 165848/week @ 2024-11-07 169391/week @ 2024-11-14 172625/week @ 2024-11-21 162041/week @ 2024-11-28 169297/week @ 2024-12-05 169270/week @ 2024-12-12 108866/week @ 2024-12-19 94208/week @ 2024-12-26 143002/week @ 2025-01-02 182855/week @ 2025-01-09 176245/week @ 2025-01-16 191880/week @ 2025-01-23 200979/week @ 2025-01-30 231939/week @ 2025-02-06

833,129 downloads per month
Used in 678 crates (4 directly)

MIT license

5KB
59 lines

UTF-8 Width

CI

To determine the width of a UTF-8 character by providing its first byte.

References: https://tools.ietf.org/html/rfc3629

Examples

assert_eq!(1, utf8_width::get_width(b'1'));
assert_eq!(3, utf8_width::get_width("".as_bytes()[0]));

Benchmark

cargo bench

Crates.io

https://crates.io/crates/utf8-width

Documentation

https://docs.rs/utf8-width

License

MIT


lib.rs:

UTF-8 Width

To determine the width of a UTF-8 character by providing its first byte.

References: https://tools.ietf.org/html/rfc3629

Examples

assert_eq!(1, utf8_width::get_width(b'1'));
assert_eq!(3, utf8_width::get_width("".as_bytes()[0]));

Benchmark

cargo bench

No runtime deps