unicode_normalization - Rust (original) (raw)
Crate unicode_normalization
Expand description
Unicode character composition and decomposition utilities as described inUnicode Standard Annex #15.
extern crate unicode_normalization;
use unicode_normalization::char::compose;
use unicode_normalization::UnicodeNormalization;
fn main() {
assert_eq!(compose('A','\u{30a}'), Some('Å'));
let s = "ÅΩ";
let c = s.nfc().collect::<String>();
assert_eq!(c, "ÅΩ");
}§crates.io
You can use this package in your project by adding the following to your Cargo.toml:
[dependencies]
unicode-normalization = "0.1.20"
Methods for composing and decomposing characters.
External iterator for a string decomposition’s characters.
External iterator for a string recomposition’s characters.
External iterator for replacements for a string’s characters.
UAX15-D4: This iterator keeps track of how many non-starters there have been since the last starter in NFKD and will emit a Combining Grapheme Joiner (U+034F) if the count exceeds 30.
QuickCheck quickly determines if a string is normalized, it can returnMaybe
Methods for iterating over strings while applying Unicode normalizations as described inUnicode Standard Annex #15.
Authoritatively check if a string is in NFC.
Quickly check if a string is in NFC, potentially returningIsNormalized::Maybe if further checks are necessary. In this case a check like s.chars().nfc().eq(s.chars()) should suffice.
Authoritatively check if a string is Stream-Safe NFC.
Quickly check if a string is Stream-Safe NFC.
Authoritatively check if a string is in NFD.
Quickly check if a string is in NFD.
Authoritatively check if a string is Stream-Safe NFD.
Quickly check if a string is Stream-Safe NFD.
Authoritatively check if a string is in NFKC.
Quickly check if a string is in NFKC.
Authoritatively check if a string is in NFKD.
Quickly check if a string is in NFKD.