1package flect 2 3import "unicode" 4 5// Capitalize will cap the first letter of string 6// user = User 7// bob dylan = Bob dylan 8// widget_id = Widget_id 9func Capitalize(s string) string { 10 return New(s).Capitalize().String() 11} 12 13// Capitalize will cap the first letter of string 14// user = User 15// bob dylan = Bob dylan 16// widget_id = Widget_id 17func (i Ident) Capitalize() Ident { 18 if len(i.Parts) == 0 { 19 return New("") 20 } 21 runes := []rune(i.Original) 22 runes[0] = unicode.ToTitle(runes[0]) 23 return New(string(runes)) 24} 25