Documentation ¶
Index ¶
- func Append(str string, strs ...string) string
- func Deduplicate(names []string) []string
- func Ignore(ignored string, names ...string) []string
- func Merge(a, b string) string
- func MergeAll(strs ...string) string
- func MergeAllTypeNames(names ...string) string
- func MimeTypeName(mt string) string
- func MimeTypeNames(mimes []string) []string
- func Overlap(a, b string) int
- func PrefixInteger(name string) string
- func RangeStatusCode(nxx string) string
- func Size(ss ...string) int
- func Split(s string) []string
- func SplitAll(names ...string) []string
- func Squeeze(s string) string
- func StatusCode(status string) string
- func StatusCodes(statuses []string) []string
- func ToTitle(name string) string
- func TypeName(name string) string
- func UnwrapAllPathParameters(modify func(string) string, path ...string) []string
- func UnwrapPathParameters(modifyNew func(string) string, path string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deduplicate ¶
Deduplicate removes duplicate string that are either equal or contain each other. The string contained in the other string will be removed.
func Ignore ¶
Ignore returns all strings that are not equal to the ignored string. Equality check is case insensitive.
func MergeAll ¶
MergeAll concatenates all strings removing duplicate overlaps between joins and overlaps across all previous joined strings with the next abC + CdeF + Fgh = abCdeFgh
func MergeAllTypeNames ¶
MergeAllTypeNames merges all type names and prefixes the result with an "N" if the result starts with an integer.
func MimeTypeName ¶
MimeTypeName returns the last part of a mime type. And converts the mime type to a Go type name.
func MimeTypeNames ¶
MimeTypeNames takes the mime types and returns the last part of each mime type. And converts the mime types to Go type names.
func Overlap ¶
Overlap returns the maximum overlap of two strings. The end of the first string is compared to the beginning of the second string. Order of the strings is important.
func PrefixInteger ¶
PrefixInteger prefixes the given name with an "N" if it is a valid integer.
func RangeStatusCode ¶
RangeStatusCode converts nXX status codes to a string representation. 1XX -> Info 2XX -> Success 3XX -> Redirect 4XX -> ClientError 5XX -> ServerError Any other will be converted to a type name.
func Split ¶
Split splits the camelcase word and returns a list of words. It also supports digits. Both lower camel case and upper camel case are supported. For more info please check: http://en.wikipedia.org/wiki/CamelCase
Examples
"" => [""] "lowercase" => ["lowercase"] "Class" => ["Class"] "MyClass" => ["My", "Class"] "MyC" => ["My", "C"] "HTML" => ["HTML"] "PDFLoader" => ["PDF", "Loader"] "AString" => ["A", "String"] "SimpleXMLParser" => ["Simple", "XML", "Parser"] "vimRPCPlugin" => ["vim", "RPC", "Plugin"] "GL11Version" => ["GL", "11", "Version"] "99Bottles" => ["99", "Bottles"] "May5" => ["May", "5"] "BFG9000" => ["BFG", "9000"] "BöseÜberraschung" => ["Böse", "Überraschung"] "Two spaces" => ["Two", " ", "spaces"] "BadUTF8\xe2\xe2\xa1" => ["BadUTF8\xe2\xe2\xa1"]
Splitting rules
- If string is not valid UTF-8, return it without splitting as single item array.
- Assign all unicode characters into one of 4 sets: lower case letters, upper case letters, numbers, and all other characters.
- Iterate through characters of string, introducing splits between adjacent characters that belong to different sets.
- Iterate through array of split strings, and if a given string is upper case: if subsequent string is lower case: move last character of upper case string to beginning of lower case string
func StatusCode ¶
StatusCode returns the status code name for a given status code. If the status code is not a valid integer, it will be returned as is. If the status code is a valid integer, but not a valid http status code, it will be returned as is.
func StatusCodes ¶
func TypeName ¶
TypeName removes all non alpha numeric characters Integers are prefixed with an "N" The first character is capitalized.
func UnwrapAllPathParameters ¶
UnwrapAllPathParameters unwraps all path placeholders
Types ¶
This section is empty.