Casing

Trait Casing 

Source
pub trait Casing {
Show 13 methods // Required methods fn to_normal_case(&self) -> String; fn to_camel_case(&self) -> String; fn to_pascal_case(&self) -> String; fn to_snake_case(&self) -> String; fn to_kebab_case(&self) -> String; fn to_dot_case(&self) -> String; fn to_path_case(&self) -> String; fn to_windows_path_case(&self) -> String; fn to_sentence_case(&self) -> String; fn to_title_case(&self) -> String; fn to_header_case(&self) -> String; fn to_upper_snake_case(&self) -> String; fn to_alternating_case(&self) -> String;
}

Required Methods§

Source

fn to_normal_case(&self) -> String

Returns a normal case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_normal_case(), "example string");
Source

fn to_camel_case(&self) -> String

Returns a camelCase version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_camel_case(), "exampleString");
Source

fn to_pascal_case(&self) -> String

Returns a PascalCase version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_pascal_case(), "ExampleString");
Source

fn to_snake_case(&self) -> String

Returns a snake_case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_snake_case(), "example_string");
Source

fn to_kebab_case(&self) -> String

Returns a kebab-case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_kebab_case(), "example-string");
Source

fn to_dot_case(&self) -> String

Returns a dot.case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_dot_case(), "example.string");
Source

fn to_path_case(&self) -> String

Returns a path/case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_path_case(), "example/string");
Source

fn to_windows_path_case(&self) -> String

Returns a windows\path\case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_windows_path_case(), "example\\string");
Source

fn to_sentence_case(&self) -> String

Returns a Sentence case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_sentence_case(), "Example string");
Source

fn to_title_case(&self) -> String

Returns a Title Case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_title_case(), "Example String");
Source

fn to_header_case(&self) -> String

Returns a Header-Case version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_header_case(), "Example-String");
Source

fn to_upper_snake_case(&self) -> String

Returns a UPPER_SNAKE_CASE version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_upper_snake_case(), "EXAMPLE_STRING");
Source

fn to_alternating_case(&self) -> String

Returns a AlTeRnAtInG cAsE version of the input text as a new String

§Example
use recase::Casing;
assert_eq!("Example String".to_alternating_case(), "eXaMpLe StRiNg");

Implementations on Foreign Types§

Source§

impl Casing for str

Implementors§