Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/magiclen/utf8-width
To determine the width of a UTF-8 character by providing its first byte.
https://github.com/magiclen/utf8-width
rust unicode
Last synced: 28 days ago
JSON representation
To determine the width of a UTF-8 character by providing its first byte.
- Host: GitHub
- URL: https://github.com/magiclen/utf8-width
- Owner: magiclen
- License: mit
- Created: 2020-06-25T01:02:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-20T14:39:03.000Z (about 1 year ago)
- Last Synced: 2024-11-08T11:13:56.339Z (about 1 month ago)
- Topics: rust, unicode
- Language: Rust
- Homepage:
- Size: 16.6 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
UTF-8 Width
====================[![CI](https://github.com/magiclen/utf8-width/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/utf8-width/actions/workflows/ci.yml)
To determine the width of a UTF-8 character by providing its first byte.
References: https://tools.ietf.org/html/rfc3629
## Examples
```rust
assert_eq!(1, utf8_width::get_width(b'1'));
assert_eq!(3, utf8_width::get_width("中".as_bytes()[0]));
```## Benchmark
```bash
cargo bench
```## Crates.io
https://crates.io/crates/utf8-width
## Documentation
https://docs.rs/utf8-width
## License
[MIT](LICENSE)