1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00
Files
Brent Barbachem f24398c617 ** Go mod vendor to update dependencies in vendor directory.
**Note: this requires go 1.18
2022-08-15 08:25:05 -04:00

33 lines
677 B
Go

package flect
import (
"strings"
)
// Pascalize returns a string with each segment capitalized
// user = User
// bob dylan = BobDylan
// widget_id = WidgetID
func Pascalize(s string) string {
return New(s).Pascalize().String()
}
// Pascalize returns a string with each segment capitalized
// user = User
// bob dylan = BobDylan
// widget_id = WidgetID
func (i Ident) Pascalize() Ident {
c := i.Camelize()
if len(c.String()) == 0 {
return c
}
if len(i.Parts) == 0 {
return i
}
capLen := 1
if _, ok := baseAcronyms[strings.ToUpper(i.Parts[0])]; ok {
capLen = len(i.Parts[0])
}
return New(string(strings.ToUpper(c.Original[0:capLen])) + c.Original[capLen:])
}