1 [![Build Status](https://travis-ci.org/markbates/inflect.svg?branch=master)](https://travis-ci.org/markbates/inflect)
5 go get github.com/markbates/inflect
13 func AddAcronym(word string)
14 func AddHuman(suffix, replacement string)
15 func AddIrregular(singular, plural string)
16 func AddPlural(suffix, replacement string)
17 func AddSingular(suffix, replacement string)
18 func AddUncountable(word string)
19 func Asciify(word string) string
20 func Camelize(word string) string
21 func CamelizeDownFirst(word string) string
22 func Capitalize(word string) string
23 func Dasherize(word string) string
24 func ForeignKey(word string) string
25 func ForeignKeyCondensed(word string) string
26 func Humanize(word string) string
27 func Ordinalize(word string) string
28 func Parameterize(word string) string
29 func ParameterizeJoin(word, sep string) string
30 func Pluralize(word string) string
31 func Singularize(word string) string
32 func Tableize(word string) string
33 func Titleize(word string) string
34 func Typeify(word string) string
35 func Uncountables() map[string]bool
36 func Underscore(word string) string
42 // contains filtered or unexported fields
50 // contains filtered or unexported fields
54 a Ruleset is the config of pluralization rules
55 you can extend the rules with the Add* methods
58 func NewDefaultRuleset() *Ruleset
60 create a new ruleset and load it with the default
61 set of common English pluralization rules
64 func NewRuleset() *Ruleset
67 create a blank ruleset. Unless you are going to
68 build your own rules from scratch you probably
69 won't need this and can just use the defaultRuleset
70 via the global inflect.* methods
73 func (rs *Ruleset) AddAcronym(word string)
75 if you use acronym you may need to add them to the ruleset
76 to prevent Underscored words of things like "HTML" coming out
80 func (rs *Ruleset) AddHuman(suffix, replacement string)
83 Human rules are applied by humanize to show more friendly
87 func (rs *Ruleset) AddIrregular(singular, plural string)
90 Add any inconsistent pluralizing/singularizing rules
94 func (rs *Ruleset) AddPlural(suffix, replacement string)
97 add a pluralization rule
100 func (rs *Ruleset) AddPluralExact(suffix, replacement string, exact bool)
103 add a pluralization rule with full string match
106 func (rs *Ruleset) AddSingular(suffix, replacement string)
112 func (rs *Ruleset) AddSingularExact(suffix, replacement string, exact bool)
114 same as AddSingular but you can set `exact` to force
118 func (rs *Ruleset) AddUncountable(word string)
120 add a word to this ruleset that has the same singular and plural form
124 func (rs *Ruleset) Asciify(word string) string
126 transforms Latin characters like é -> e
129 func (rs *Ruleset) Camelize(word string) string
131 "dino_party" -> "DinoParty"
134 func (rs *Ruleset) CamelizeDownFirst(word string) string
136 same as Camelcase but with first letter downcased
139 func (rs *Ruleset) Capitalize(word string) string
141 uppercase first character
144 func (rs *Ruleset) Dasherize(word string) string
146 "SomeText" -> "some-text"
149 func (rs *Ruleset) ForeignKey(word string) string
151 an underscored foreign key name "Person" -> "person_id"
154 func (rs *Ruleset) ForeignKeyCondensed(word string) string
156 a foreign key (with an underscore) "Person" -> "personid"
159 func (rs *Ruleset) Humanize(word string) string
161 First letter of sentence capitalized
162 Uses custom friendly replacements via AddHuman()
165 func (rs *Ruleset) Ordinalize(str string) string
170 func (rs *Ruleset) Parameterize(word string) string
172 param safe dasherized names like "my-param"
175 func (rs *Ruleset) ParameterizeJoin(word, sep string) string
177 param safe dasherized names with custom separator
180 func (rs *Ruleset) Pluralize(word string) string
182 returns the plural form of a singular word
185 func (rs *Ruleset) Singularize(word string) string
187 returns the singular form of a plural word
190 func (rs *Ruleset) Tableize(word string) string
192 Rails style pluralized table names: "SuperPerson" -> "super_people"
195 func (rs *Ruleset) Titleize(word string) string
197 Capitalize every word in sentence "hello there" -> "Hello There"
200 func (rs *Ruleset) Typeify(word string) string
202 "something_like_this" -> "SomethingLikeThis"
205 func (rs *Ruleset) Uncountables() map[string]bool
209 func (rs *Ruleset) Underscore(word string) string
212 lowercase underscore version "BigBen" -> "big_ben"