Skip to content

kebab_case

Converts s to kebab-case.

Splits words the same way as camel_case.

use helpers4::string::kebab_case;

Cargo feature string (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features string

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.5", default-features = false, features = ["string"] }
pub fn kebab_case(s: &str) -> String
ParameterTypeDescription
s&strThe text to convert.

String

use helpers4::string::kebab_case;

assert_eq!(kebab_case("helloWorld"), "hello-world");
assert_eq!(kebab_case("user_name"), "user-name");
assert_eq!(kebab_case(""), "");

src/string/kebab_case.rs