Skip to main content

to_title_case

Function to_title_case 

Source
fn to_title_case(s: &str) -> String
Expand description

Translate a field name to a title case string suitable for use in the category names on the vscode settings page.

First letter of word should be uppercase, if an uppercase letter is encountered, add a space before it e.g. “fooBar” -> “Foo Bar”, “fooBarBaz” -> “Foo Bar Baz”, “foo” -> “Foo”

This likely should be in stdx (or just use heck instead), but it doesn’t handle any edge cases and is intentionally simple.