camel_case

Function camel_case 

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

Converts a string to camelCase.

Splits the input string into words based on spaces, hyphens, and underscores, then converts the first word to lowercase and capitalizes the first letter of each subsequent word, and joins them together.

§Arguments

  • str_input - The input string to convert

§Returns

  • String - The converted string in camelCase

§Examples

use lowdash::camel_case;

assert_eq!(camel_case("hello world"), "helloWorld");
assert_eq!(camel_case("foo-bar"), "fooBar");
assert_eq!(camel_case("lorem_ipsum"), "loremIpsum");
assert_eq!(camel_case("FooBarBazHello"), "fooBarBazHello");