[go: up one dir, main page]

Module case

Source
Expand description

Utilities to change the case of a string to another case. Supports “lower case,” “UPPER CASE,” “sentence case,” “Title Case,” “camelCase,” “PascalCase,” “kebab-case,” “Train-Case,” “snake_case,” and “CONSTANT_CASE.”

For more information Wikipedia has an interesting article on these special case styles.

§Example

use inflections::case::to_camel_case;

assert_eq!(to_camel_case("Hello World"), "helloWorld".to_owned());

Functions§

is_camel_case
Check to see if a string is camelCase.
is_constant_case
Check to see if a string is CONSTANT_CASE.
is_kebab_case
Check to see if a string is kebab-case.
is_lower_case
Check to see if a string is completely lower case.
is_pascal_case
Check to see if a string is PascalCase.
is_sentence_case
Check to see if a string is sentence case.
is_snake_case
Check to see if a string is snake_case.
is_title_case
Check to see if a string is Title Case.
is_train_case
Check to see if a string is Train-Case.
is_upper_case
Check to see if a string is completely UPPER CASE.
to_camel_case
Converts any case into camelCase.
to_constant_case
Converts any case into CONSTANT_CASE.
to_kebab_case
Converts any case into kebab-case.
to_lower_case
Converts any case into lower case ignoring separators.
to_pascal_case
Converts any case into PascalCase.
to_sentence_case
Converts any case into traditional sentence case without capitalizing the first letter.
to_snake_case
Converts any case into snake_case.
to_title_case
Converts any case into title case where every word is capitalized.
to_train_case
Converts any case into Train-Case.
to_upper_case
Converts any case into UPPER CASE ignoring separators.