pub fn to_camel_case(s: &str) -> StringExpand description
Convert string to camelCase.
Converts snake_case and other formats to camelCase by capitalizing the first
letter of each word (except the first word) and removing separators.
Edge cases:
- First word stays lowercase
- Consecutive separators are treated as single separator
- Leading/trailing separators produce leading/trailing underscores
ยงExamples
use spikard_cli::codegen::common::case_conversion::to_camel_case;
assert_eq!(to_camel_case("user"), "user");
assert_eq!(to_camel_case("get_user"), "getUser");
assert_eq!(to_camel_case("create_user_profile"), "createUserProfile");
assert_eq!(to_camel_case("_id"), "_id");
assert_eq!(to_camel_case("id_"), "id_");