# case::CaseExt - Rust
API documentation for the Rust `CaseExt` trait in crate `case`.
Keywords: rust, rustlang, rust-lang, CaseExt

# Trait case::CaseExt [−] [src]

    pub trait CaseExt {
        type Owned;
        fn to_capitalized(&self) -> Self::Owned;
        fn to_camel(&self) -> Self::Owned;
        fn to_camel_lowercase(&self) -> Self::Owned;
        fn to_snake(&self) -> Self::Owned;
        fn to_dashed(&self) -> Self::Owned;
    }

## Associated Types

### `type Owned` [src]

Loading content...

## Required methods

### `fn to_capitalized(&self) -> Self::Owned` [src]

Create a new string from a string slice with replacing the first character with its to ASCII upper case counterpart (if one exists).

# Examples

    use case::CaseExt;

    assert_eq!(&CaseExt::to_capitalized("stringy string"), "Stringy string");
    assert_eq!(&CaseExt::to_capitalized("言語"), "言語");

### `fn to_camel(&self) -> Self::Owned` [src]

Convert a string slice from snake case to a new capitalized camel case string.

# Examples

    use case::CaseExt;

    assert_eq!(&"a_string_and_a_miss".to_camel(), "AStringAndAMiss");
    assert_eq!(&"fooby".to_camel(), "Fooby");
    assert_eq!(&"_wild__underscore_s_".to_camel(), "WildUnderscoreS");
    assert_eq!(&"言_語".to_camel(), "言語");

### `fn to_camel_lowercase(&self) -> Self::Owned` [src]

Convert a string slice from snake case to a new uncapitalized camel case string.

# Examples

    use case::CaseExt;

    assert_eq!(&"string_henry_iii".to_camel_lowercase(), "stringHenryIii");
    assert_eq!(&"fooby".to_camel_lowercase(), "fooby");
    assert_eq!(&"_wild__underscore_s_".to_camel_lowercase(), "WildUnderscoreS");
    assert_eq!(&"言_語".to_camel_lowercase(), "言語");

### `fn to_snake(&self) -> Self::Owned` [src]

Convert a string from camel case to snake case.

# Examples

    use case::CaseExt;

    assert_eq!(&"martinLutherStringJr".to_snake(), "martin_luther_string_jr");
    assert_eq!(&"fooby".to_snake(), "fooby");
    assert_eq!(&"WildUnderscoreS".to_snake(), "wild_underscore_s");
    assert_eq!(&"言語".to_snake(), "言語");

### `fn to_dashed(&self) -> Self::Owned` [src]

Replaces underscores with dashes in a string.

# Examples

    use case::CaseExt;

    assert_eq!(&"stringing_in_the_rain".to_dashed(), "stringing-in-the-rain");

Loading content...

## Implementations on Foreign Types

### `impl CaseExt for str` [src]

#### `type Owned = String`

#### `fn to_capitalized(&self) -> Self::Owned` [src]

#### `fn to_camel(&self) -> String` [src]

#### `fn to_camel_lowercase(&self) -> String` [src]

#### `fn to_snake(&self) -> String` [src]

#### `fn to_dashed(&self) -> String` [src]

Loading content...

## Implementors

Loading content...