Documentation ¶
Overview ¶
Package inflect provides (some) english language string transformation utilities.
Index ¶
- func Capitalize(s string) (ret string)
- func Fields(s string) []string
- func FirstWord(s string) string
- func IsCapitalized(n string) (ret bool)
- func IsSpace(r rune) (ret bool)
- func Join(els []string) string
- func MixedCaseToSpaces(s string) string
- func Normalize(s string) string
- func NumToWords(n int) (ret string, okay bool)
- func Pluralize(s string) (ret string)
- func SentenceCase(s string) string
- func Singularize(s string) (ret string)
- func Titlecase(s string) (ret string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capitalize ¶
Capitalize returns a new string, starting the first word with a capital.
func FirstWord ¶
given a normalized phrase, return the first word ( exists to try to break up dependence on space as the separator of words )
func IsCapitalized ¶
IsCapitalized returns true if the passed string starts with an upper case letter.
func IsSpace ¶
IsSpace reports whether the rune is a space character as defined by lower ascii. '\t', '\n', '\v', '\f', '\r', ' ' it specifically excludes non-breaking spaces.
func MixedCaseToSpaces ¶
MixedCaseToSpaces takes a MixedCaseWord and splits it into lowercase words ( ex. mixed case word )
func Normalize ¶
Normalize lowercases the passed string, trims spaces, and eats some kinds of punctuation. Ascii underscores (_) are treated as whitespace, ascii dashes (-) are kept; all other unicode punctuation gets removed. Whitespace gets removed at the front and end of the strings; any remaining groups of one or more ws characters get replaced by a single space.
func Pluralize ¶
Pluralize attempts to return the plural form of the passed assumed singular string.
func SentenceCase ¶
SentenceCase returns the passed string in lowercase, starting new sentences with capital letters.
func Singularize ¶
Singularize attempts to return the singular form of the passed assumed plural string.
Types ¶
This section is empty.