Crates.io | case |
lib.rs | case |
version | 1.0.0 |
source | src |
created_at | 2015-06-01 12:50:28.310206 |
updated_at | 2018-11-21 00:18:11.127883 |
description | A set of letter case string helpers |
homepage | |
repository | https://github.com/SkylerLipthay/case |
max_upload_size | |
id | 2278 |
size | 9,771 |
This is a set of letter case string helpers.
If you're using Cargo, just add case
to your Cargo.toml
:
[dependencies]
case = "1.0.0"
extern crate case;
use case::CaseExt;
// Snake case operations:
assert_eq!(&"a_string_and_a_miss".to_camel(), "AStringAndAMiss");
assert_eq!(&"string_henry_iii".to_camel_lowercase(), "stringHenryIii");
assert_eq!(&"stringing_in_the_rain".to_dashed(), "stringing-in-the-rain");
// Camel case operations:
assert_eq!(&"martinLutherStringJr".to_snake(), "martin_luther_string_jr");
assert!(&"martinLutherStringJr".is_camel_lowercase());
// Universal operations:
assert_eq!(&"stringy string".to_capitalized(), "Stringy string");
assert!(&"Stringy string".is_capitalized());
to_human
/to_human_lowercase
: convert underscores to spaces and optionally capitalize the
first characterto_title
: convert underscores to spaces and capitalize each word's first character