use traditional controller tool to generate code
This commit is contained in:
27
vendor/github.com/gobuffalo/flect/capitalize.go
generated
vendored
Normal file
27
vendor/github.com/gobuffalo/flect/capitalize.go
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
package flect
|
||||
|
||||
import "unicode"
|
||||
|
||||
// Capitalize will cap the first letter of string
|
||||
// user = User
|
||||
// bob dylan = Bob dylan
|
||||
// widget_id = Widget_id
|
||||
func Capitalize(s string) string {
|
||||
return New(s).Capitalize().String()
|
||||
}
|
||||
|
||||
// Capitalize will cap the first letter of string
|
||||
// user = User
|
||||
// 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)
|
||||
}
|
||||
Reference in New Issue
Block a user