pub fn to_camel_case(input: &str) -> StringExpand description
Converts a string to camelCase.
Transforms input into camelCase format where the first word is lowercase and subsequent words have their first letter capitalized, with all spaces, hyphens, and underscores removed.
§Use Cases
- API Development: Convert field names to JavaScript/Java conventions
- Code Generation: Transform human-readable names to variable names
- Data Transformation: Normalize naming conventions across systems
§Examples
use redstr::to_camel_case;
assert_eq!(to_camel_case("hello world"), "helloWorld");
assert_eq!(to_camel_case("user_first_name"), "userFirstName");
assert_eq!(to_camel_case("get-user-id"), "getUserId");
assert_eq!(to_camel_case("API Response Code"), "apiResponseCode");