kebab_case

Function kebab_case 

Source
pub fn kebab_case(str_input: &str) -> String
Expand description

Converts a string to kebab-case.

Splits the input string into words based on spaces, hyphens, underscores, and capitalization, then converts each word to lowercase and joins them with hyphens.

§Arguments

  • str_input - The input string to convert

§Returns

  • String - The converted string in kebab-case

§Examples

use lowdash::kebab_case;

assert_eq!(kebab_case("hello world"), "hello-world");
assert_eq!(kebab_case("foo-bar"), "foo-bar");
assert_eq!(kebab_case("lorem_ipsum"), "lorem-ipsum");
assert_eq!(kebab_case("FooBarBazHello"), "foo-bar-baz-hello");
assert_eq!(kebab_case("helloWorld"), "hello-world");