rust_locale
provides various functions dependent on locale specified in POSIX.1.
The main purpose is to provide something that is not in char
methods or that differs in behavior from char
methods.
[dependencies]
rust-locale = "0.1"
```rust use rust_locale::CType;
// space is different from whitespace assert!('\x0c'.isspace()); # form feed std::env::setvar("LCALL", "enUS"); assert!('\u{2003}'.isspace()); # Em Space assert!(!'\u{1361}'.isspace()); # Ethiopic Wordspace std::env::setvar("LCALL", "amET"); assert!('\u{1361}'.isspace());
// different behavior from char::touppercase std::env::setvar("LCALL", "enUS"); asserteq!(CType::touppercase(&'i'), 'I'); std::env::setvar("LCALL", "trTR"); asserteq!(CType::to_uppercase(&'i'), '\u{0130}'); # Latin Capital Letter I with Dot Above ```
These tests may fail depending on the locales' definition.
is_blank
Feature requests are welcome.
rust-locale
uses Gnulib for the platform compatibility. Gnulib is LGPL and rust-locale
links to it statically, therefore rust-locale
is also LGPL.
If you use rust-locale
and not want to adapt LGPL, you may need to link to rust-locale
dynamically.
If that is difficult, I will consider linking rust-locale
to Gnulib dynamically and change rust-locale
's license to MIT.