pub fn to_kebab_case(s: &str) -> StringExpand description
Converts a string to kebab-case
Handles multiple input formats:
camelCase:"getUserById"-> “get-user-by-id”PascalCase:"GetUser"-> “get-user”snake_case:"get_user_by_id"-> “get-user-by-id”- Spaces: “List an Organization’s Issues” -> “list-an-organizations-issues”
- Mixed:
"XMLHttpRequest"-> “xml-http-request” - Unicode:
"CAFÉ"-> “café”
Special handling:
- Apostrophes are removed entirely: “Organization’s” -> “organizations”
- Special characters become hyphens: “hello!world” -> “hello-world”
- Consecutive non-alphanumeric characters are collapsed: “a—b” -> “a-b”
- Leading/trailing hyphens are trimmed
- Unicode characters are properly lowercased