1 package name 2 3 import "unicode" 4 5 // Char returns the first letter, lowered 6 // "" = "x" 7 // "foo" = "f" 8 // "123d456" = "d" 9 func Char(s string) string { 10 return New(s).Char().String() 11 } 12 13 // Char returns the first letter, lowered 14 // "" = "x" 15 // "foo" = "f" 16 // "123d456" = "d" 17 func (i Ident) Char() Ident { 18 for _, c := range i.Original { 19 if unicode.IsLetter(c) { 20 return New(string(unicode.ToLower(c))) 21 } 22 } 23 return New("x") 24 } 25