Skip to content

Repository files navigation

inflect

Circle CIBuild StatusCoverage StatusGoDocGo Report Card

Installing

go get

$ go get -u github.com/martinusso/inflect

Using

IntoWords()

IntoWords convert numbers (float64) to words

funcIntoWords(numberfloat64) string
got:=IntoWords(42) // -> forty-twogot:=IntoWords(-147) // -> Minus one hundred and forty-seven

IsConsonant

IsConsonant check if a character is a consonant

funcIsConsonant(sstring) bool

IsVowel

IsVowel check if a character is a vowel

funcIsVowel(sstring) bool

Ordinal

Ordinal returns the ordinal suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th...

funcOrdinal(numberint) string
got:=Ordinal(-1) // -> stgot:=Ordinal(42) // -> nd

Ordinalize

Ordinalize turns a number into an ordinal string

funcOrdinalize(numberint) string
got:=Ordinal(-1) // -> -1stgot:=Ordinal(42) // -> 42nd

Parameterize

Parameterize replaces special characters in a pretty string

funcParameterize(sstring) string
got:=Parameterize("J. R. R. Tolkien") // -> "j-r-r-tolkien"

ParameterizeSep

ParameterizeSep replaces special characters, according to the separator, in a string

funcParameterizeSep(s, sepstring) string
got:=ParameterizeSep("J. R. R. Tolkien", "_") // -> "j_r_r_tolkien"

Pluralize

Pluralize generates the plurals of nouns

funcPluralize(wordstring) string
got:=Plural("word") // -> wordsgot:=Plural("noun") // -> nouns

License

This software is open source, licensed under the The MIT License (MIT). See LICENSE for details.

About

Go library for plurals of nouns, ordinalize numbers, parameterize/transliterate/camelize/underscore strings, convert numbers to words and more

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages