inflect

package module
Version: v0.0.0-...-bfc9dcd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2019 License: MIT Imports: 6 Imported by: 0

README

Package inflect can pluralize ("cat" => "cats", "man" => "men") or singularize ("cats" => "cat", "men" => "man") English language nouns.

API docs are here.

Usage:

import "github.com/kjk/inflect"

inflect.ToPlural("man") // "men"
inflect.ToPlural("men") // "men"

inflect.ToSingular("men") // "man"
inflect.ToSingular("man") // "man"

inflect.IsPlural("cats") // true
inflect.IsPlural("cat")  // false

inflect.IsSingular("cat")  // true
inflect.IsSingular("cats") // false

This is a Go port of https://github.com/blakeembrey/pluralize

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPlural

func IsPlural(word string) bool

IsPlural retruns true if word is plural

func IsSingular

func IsSingular(word string) bool

IsSingular returns true if a word is singular

func Pluralize

func Pluralize(word string, count int, inclusive bool) string

Pluralize or singularize a word based on the passed in count.

func ToPlural

func ToPlural(word string) string

ToPlural makes a pluralized version of a word

func ToSingular

func ToSingular(word string) string

ToSingular singularizes a word.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL