string_morph 0.1.0

string_morph is a library of string case transformations with an emphasis on accuracy and performance. The case conversions are available as functions as well as traits on String types.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use converter::{convert_case, CapitalizeType};

/// Convert a string to a kebab cased string
///
/// # Examples
///
/// ```
/// assert_eq!("lorem-ipsum-dolor", string_morph::to_kebab_case("lorem_ipsum_dolor"))
/// ```

pub fn to_kebab_case(input: &str) -> String {
    convert_case(input.to_string(), CapitalizeType::AllLowercase, true, '-')
}