diff --git a/capitalize.go b/capitalize.go index 42ecc16..78334fc 100644 --- a/capitalize.go +++ b/capitalize.go @@ -15,13 +15,10 @@ func Capitalize(s string) string { // bob dylan = Bob dylan // widget_id = Widget_id func (i Ident) Capitalize() Ident { - var x string if len(i.Parts) == 0 { return New("") } - x = string(unicode.ToTitle(rune(i.Original[0]))) - if len(i.Original) > 1 { - x += i.Original[1:] - } - return New(x) + runes := []rune(i.Original) + runes[0] = unicode.ToTitle(runes[0]) + return New(string(runes)) } diff --git a/capitalize_test.go b/capitalize_test.go index b2777da..ac8650f 100644 --- a/capitalize_test.go +++ b/capitalize_test.go @@ -15,6 +15,7 @@ func Test_Capitalize(t *testing.T) { {"widget_id", "Widget_id"}, {"widget_ID", "Widget_ID"}, {"widget ID", "Widget ID"}, + {"гофер", "Гофер"}, // it's "gopher" in Ukrainian } for _, tt := range table {