unicode-truncate 2.0.1

Unicode-aware algorithm to pad or truncate `str` in terms of displayed width.
Documentation
1
2
3
4
5
6
7
8
#![no_std]

use unicode_truncate::UnicodeTruncateStr;

#[test]
fn main() {
    assert_eq!("你好吗".unicode_truncate(5), ("你好", 4));
}