Documentation ¶
Overview ¶
Package stringext adds extra power to the strings package with helper functions
Index ¶
- func AsComment(c string) string
- func Capitalize(str string) string
- func Contains(n string, r []string) bool
- func Depunct(ident string, initialCap bool) string
- func DepunctWithInitialLower(ident string) string
- func DepunctWithInitialUpper(ident string) string
- func Equal(a, b string) bool
- func JSONTag(n string, required bool) string
- func JSONTagWithIgnored(n string, required bool, ignored bool, fieldType string, forceTags string) string
- func Normalize(s string) string
- func Pointerize(ident string) string
- func ToFieldName(u string) string
- func ToLowerFirst(ident string) string
- func ToUpperFirst(ident string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsComment ¶
AsComment formats the given string as if it is a Go Comment, breaks lines every 78 lines
func Capitalize ¶
Capitalize uppercases the first char of s and lowercases the rest.
func DepunctWithInitialLower ¶
DepunctWithInitialLower does special operations to the given string, while operating lowercases the special words
func DepunctWithInitialUpper ¶
DepunctWithInitialUpper does special operations to the given string, while operating uppercases the special words
func JSONTag ¶
JSONTag generates json tag for given string, it is using the javascript concepts
eg: ID ->
becomes "id" if it is at the beginning or becomes "Id" if it is in the middle of the string
func JSONTagWithIgnored ¶
func Normalize ¶
Normalize removes non a-z characters and uppercases the following character, all characters followed by it will be lowercased if the word is one the acronymsi
func Pointerize ¶
Pointerize returns the first character of a given string as lowercased, this method is intened to use as a function receiver generator
func ToFieldName ¶
ToFieldName handles field names, if the given string is one of the `acronymsi` it is lowercasing it
given "URL" as parameter converted to "url" given "ProfileURL" as parameter converted to "profile_url" given "Profile" as parameter converted to "profile" given "ProfileName" as parameter converted to "profile_name"
func ToLowerFirst ¶
ToLowerFirst lowers the first character of any given unicode char
func ToUpperFirst ¶
ToUpperFirst converts the first character of any given unicode char to uppercase
Types ¶
This section is empty.