Crates.io | roe |
lib.rs | roe |
version | 0.0.5 |
source | src |
created_at | 2021-02-15 03:04:40.507911 |
updated_at | 2023-06-02 17:39:27.560373 |
description | Unicode case conversion |
homepage | https://github.com/artichoke/roe |
repository | https://github.com/artichoke/roe |
max_upload_size | |
id | 355296 |
size | 93,375 |
Implements Unicode case mapping for conventionally UTF-8 binary strings.
Case mapping or case conversion is a process whereby strings are converted to a particular form—uppercase, lowercase, or titlecase—possibly for display to the user.
roe
can convert conventionally UTF-8 binary strings to capitalized, lowercase,
and uppercase forms. This crate is used to implement String#capitalize
,
Symbol#capitalize
, String#downcase
, Symbol#downcase
,
String#upcase
, and Symbol#upcase
in Artichoke Ruby.
This crate depends on bstr
.
This crate is currently a work in progress. When the API is complete, Roe will support lowercase, uppercase, titlecase, and case folding iterators for conventionally UTF-8 byte slices.
Roe will implement support for full, Turkic, ASCII, and case folding transforms.
Add this to your Cargo.toml
:
[dependencies]
roe = "0.0.5"
Then convert case like:
use roe::{LowercaseMode, UppercaseMode};
assert_eq!(
roe::lowercase(b"Artichoke Ruby", LowercaseMode::Ascii).collect::<Vec<_>>(),
b"artichoke ruby"
);
assert_eq!(
roe::uppercase("Αύριο".as_bytes(), UppercaseMode::Full).collect::<Vec<_>>(),
"ΑΎΡΙΟ".as_bytes()
);
roe
is no_std
compatible with an optional dependency on the alloc
crate.
roe
has several Cargo features, all of which are enabled by default:
std
, the Rust Standard Library. This
feature enables std::error::Error
implementations on error types in this
crate. Enabling the std feature also enables the alloc feature.alloc
, the Rust allocation and
collections library. This feature enables APIs that allocate String
or
Vec
.roe
is licensed under the MIT License (c) Ryan Lopopolo.