2 unstable releases
0.9.0 | Mar 3, 2019 |
---|---|
0.8.0 | Jan 2, 2019 |
#39 in #iteration
598 downloads per month
Used in 5 crates
(2 directly)
17KB
164 lines
UNIC — Unicode Character Tools — Basic Stable Character Properties
This UNIC component provides basic Unicode Character properties that are core to string processing and are stabilized by The Unicode Standard and will never change in the future.
lib.rs
:
UNIC — Unicode Character Tools — Basic Stable Character Properties
A simple way to control iteration over a range of characters.
Examples
extern crate unic_char_basics;
use unic_char_basics::{is_noncharacter, is_private_use};
// Plane 0 (BMP)
assert_eq!(is_noncharacter('\u{0}'), false);
assert_eq!(is_noncharacter('\u{80}'), false);
assert_eq!(is_noncharacter('\u{e000}'), false);
assert_eq!(is_noncharacter('\u{f8ff}'), false);
assert_eq!(is_noncharacter('\u{fdd0}'), true);
assert_eq!(is_noncharacter('\u{fdef}'), true);
assert_eq!(is_noncharacter('\u{fffd}'), false);
assert_eq!(is_noncharacter('\u{fffe}'), true);
assert_eq!(is_noncharacter('\u{ffff}'), true);
assert_eq!(is_private_use('\u{0}'), false);
assert_eq!(is_private_use('\u{80}'), false);
assert_eq!(is_private_use('\u{e000}'), true);
assert_eq!(is_private_use('\u{f8ff}'), true);
assert_eq!(is_private_use('\u{fdd0}'), false);
assert_eq!(is_private_use('\u{fdef}'), false);
assert_eq!(is_private_use('\u{fffd}'), false);
assert_eq!(is_private_use('\u{fffe}'), false);
assert_eq!(is_private_use('\u{ffff}'), false);
// Plane 16 (PUA-B)
assert_eq!(is_noncharacter('\u{10_0000}'), false);
assert_eq!(is_noncharacter('\u{10_0001}'), false);
assert_eq!(is_noncharacter('\u{10_fffd}'), false);
assert_eq!(is_noncharacter('\u{10_fffe}'), true);
assert_eq!(is_noncharacter('\u{10_ffff}'), true);
assert_eq!(is_private_use('\u{10_0000}'), true);
assert_eq!(is_private_use('\u{10_0001}'), true);
assert_eq!(is_private_use('\u{10_fffd}'), true);
assert_eq!(is_private_use('\u{10_fffe}'), false);
assert_eq!(is_private_use('\u{10_ffff}'), false);