Mateusz Urbański Mateusz Urbański - 1 month ago 8
Ruby Question

Gem that formats first and last names

I'm looking for a ruby gem that formats first and last names.

For example:
I have string "john mc'queen" and it formats it to: "John Mc'Queen".

Is there any gem that is doing such a thing? Or maybe there is other solution for that?

Answer

Here you are, example from documentation

require 'capitalize_names'

CapitalizeNames.capitalize("TATE") # => "Tate"
CapitalizeNames.capitalize("JoHn O'NEILL") # => "John O'Neill"
CapitalizeNames.capitalize("macarthur") # => "MacArthur"
CapitalizeNames.capitalize("rick johnson-smith") # => "Rick Johnson-Smith"
CapitalizeNames.capitalize("bob jones, iii") # => "Bob Jones, III"
Comments