String.capitalize() should have a “leave the rest of the word alone” option

The reason why we do first letter only is because Unicode has specific rules that consider the rest is being lowercased.

For the behaviour that you want, you should be able to implement it using String.next_grapheme, getting the first part, upcasing it an then concatenating the rest. Just make sure to take into account empty strings.

Don’t do this. :slight_smile: String.Casing is private API and may change at any time, breaking your code.

5 Likes