Documentation ¶
Index ¶
- Constants
- Variables
- func CaseKebabToCamel(s string) string
- func CaseKebabToPascal(s string) string
- func CaseKebabToSnake(s string) string
- func CaseSnakeToCamel(s string) string
- func CaseSnakeToKebab(s string) string
- func CaseSnakeToPascal(s string) string
- func FuncToCase(c string) (func(string) string, error)
- func FuncToCaseMore(c string, overrides map[string]string) (func(string) string, error)
- func FuncToWantCaseOrDefault(c string, defaultFunc func(string) string) func(string) string
- func FuncToWantCaseOrNoOp(c string) func(string) string
- func IsCamelCase(input string) bool
- func IsCase(caseType, s string) (bool, error)
- func IsFirstAlphaUpper(s string) bool
- func IsKebabCase(input string) bool
- func IsPascalCase(input string) bool
- func IsSnakeCase(input string) bool
- func Join(elems []string, sep string, wantCase string) (string, error)
- func NoOp(s string) string
- func Parse(s string) (string, error)
- func ToCamelCase(s string) string
- func ToCase(c, s string) (string, error)
- func ToKebabCase(s string) string
- func ToPascalCase(s string) string
- func ToSnakeCase(s string) string
Constants ¶
View Source
const ( CamelCase = "camelCase" KebabCase = "kebab-case" PascalCase = "PascalCase" SnakeCase = "snake_case" )
Variables ¶
View Source
var ErrUnknownCaseString = errors.New("unknown case string")
Functions ¶
func CaseKebabToCamel ¶
func CaseKebabToPascal ¶
func CaseKebabToSnake ¶
func CaseSnakeToCamel ¶
func CaseSnakeToKebab ¶
func CaseSnakeToPascal ¶
func FuncToCase ¶ added in v0.58.0
FuncToCase returns to the ToXCase function given a case.
func FuncToCaseMore ¶ added in v0.58.0
FuncToCaseMore returns the function to convert case.
func FuncToWantCaseOrDefault ¶ added in v0.41.10
FuncToWantCaseOrDefault returns an ToWantCase function, or default if case is not preseent or parseable. For flexibility, if a `nil` func is passed, `nil`, is returned.
func FuncToWantCaseOrNoOp ¶ added in v0.41.10
func IsCamelCase ¶
IsCamelCase returns if a string is camelCase or not.
func IsFirstAlphaUpper ¶
IsFirstAlphaUpper returns if the first character is a capital [A-Z] character.
func IsKebabCase ¶
func IsPascalCase ¶
IsPascalCase returns if a string is PascalCase or not.
func IsSnakeCase ¶
func ToCamelCase ¶
ToCamelCase converts a string to camel case as `camelCase`.
func ToKebabCase ¶ added in v0.40.7
func ToPascalCase ¶
ToPascalCase converts a string to Pascal case as `PascalCase`.
func ToSnakeCase ¶ added in v0.40.7
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.