#upcase_first_char method to upcase only the first letter, not the rest

Hi All,

I recently had to upcase the first char and gave #capitalize a try but I discovered that it downcase everything else.

This is not necessary good when dealing with strings containing names or acronyms

E.g. if I’ve a string like this “my name is Aldo and I like BBQ” and I use #capitalize it will downcase “I”, “Aldo” and “BBQ” which could not be what I want.

What about a method which upcase the first characher leaving the rest untouched?

We have #titleize and #capitalize and I think we should also have a method to upcase just the first letter.

I know I could just manually add something in my app (and I did) but I think a method like this would be very useful (see http://stackoverflow.com/q/2646709 for example).

I added a method called #upcase_first_char and made a pull request: https://github.com/rails/rails/pull/15319

Apologies if I did this before asking in the ML, first non-doc pull request here :slight_smile:

Aldo