Documentation ¶
Overview ¶
Package wordUtils provides some string utilities regarding words.
Index ¶
- func Capitalize(str string) string
- func CapitalizeDelimited(str string, delimiters ...string) string
- func ContainsAllWords(str string, words ...string) bool
- func Initials(str string) string
- func InitialsDelimited(str string, delimiters ...string) string
- func SwapCase(str string) string
- func Uncapitalize(str string) string
- func UncapitalizeDelimited(str string, delimiters ...string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capitalize ¶
Capitalize capitalizes all the whitespace separated words in a String. Only the first letter of each word is changed.
func CapitalizeDelimited ¶
CapitalizeDelimited capitalizes all the delimiter separated words in a String. Only the first letter of each word is changed. To convert the rest of each word to lowercase at the same time.
The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized.
func ContainsAllWords ¶
ContainsAllWords checks if the String contains all words.
func Initials ¶
Initials extracts the initial letters from each word in the String.
The first letter of the string and all first letters after the defined delimiters are returned as a new string. Their case is not changed.
func InitialsDelimited ¶
InitialsDelimited extracts the initial letters from each word in the String.
The first letter of the string and all first letters after the defined delimiters are returned as a new string. Their case is not changed.
func SwapCase ¶
SwapCase swaps the case of a String using a word based algorithm.
Upper case character converts to Lower case. Title case character converts to Lower case. Lower case character after Whitespace or at start converts to Title case. Other Lower case character converts to Upper case.
func Uncapitalize ¶
Uncapitalize uncapitalizes all the whitespace separated words in a string. Only the first letter of each word is changed.
func UncapitalizeDelimited ¶
UncapitalizeDelimited uncapitalizes all the whitespace separated words in a String. Only the first letter of each word is changed.
The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter character after a delimiter will be uncapitalized.
Types ¶
This section is empty.