Function inflections::case::to_train_case[][src]

pub fn to_train_case(string: &str) -> String
Expand description

Converts any case into Train-Case.

Example

let train = "Hello-World".to_owned();
assert_eq!(to_train_case("hello world"), train);
assert_eq!(to_train_case("HELLO WORLD"), train);
assert_eq!(to_train_case("Hello World"), train);
assert_eq!(to_train_case("helloWorld"), train);
assert_eq!(to_train_case("HelloWorld"), train);
assert_eq!(to_train_case("hello-world"), train);
assert_eq!(to_train_case("Hello-World"), train);
assert_eq!(to_train_case("hello_world"), train);
assert_eq!(to_train_case("HELLO_WORLD"), train);