stash/vendor/github.com/gobuffalo/flect/name/char.go
2019-02-09 04:32:50 -08:00

24 lines
428 B
Go

package name
import "unicode"
// Char returns the first letter, lowered
// "" = "x"
// "foo" = "f"
// "123d456" = "d"
func Char(s string) string {
return New(s).Char().String()
}
// Char returns the first letter, lowered
// "" = "x"
// "foo" = "f"
// "123d456" = "d"
func (i Ident) Char() Ident {
for _, c := range i.Original {
if unicode.IsLetter(c) {
return New(string(unicode.ToLower(c)))
}
}
return New("x")
}