kilo/vendor/github.com/gobuffalo/flect/titleize.go
leonnicolas 36643b77b4
Use apiextension v1
- upgrade from apiextension v1beta1 to v1
 - generate yaml manifest for crd intead of applying it at runtime
  - users will have to apply the manifest with kubectl
 - kg and kgctl log an error if the crd is not present
 - now validation should actually work

Signed-off-by: leonnicolas <leonloechner@gmx.de>
2021-06-14 12:59:33 +02:00

31 lines
772 B
Go

package flect
import (
"strings"
"unicode"
)
// Titleize will capitalize the start of each part
// "Nice to see you!" = "Nice To See You!"
// "i've read a book! have you?" = "I've Read A Book! Have You?"
// "This is `code` ok" = "This Is `code` OK"
func Titleize(s string) string {
return New(s).Titleize().String()
}
// Titleize will capitalize the start of each part
// "Nice to see you!" = "Nice To See You!"
// "i've read a book! have you?" = "I've Read A Book! Have You?"
// "This is `code` ok" = "This Is `code` OK"
func (i Ident) Titleize() Ident {
var parts []string
for _, part := range i.Parts {
x := string(unicode.ToTitle(rune(part[0])))
if len(part) > 1 {
x += part[1:]
}
parts = append(parts, x)
}
return New(strings.Join(parts, " "))
}