inflector

package module
v0.0.0-...-16278e9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2017 License: BSD-2-Clause Imports: 5 Imported by: 235 modules, 201 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Inflector

Inflector pluralizes and singularizes English nouns.

Build Status Coverage Status GoDoc

Basic Usage

There are only two exported functions: Pluralize and Singularize.

fmt.Println(inflector.Singularize("People")) // will print "Person"
fmt.Println(inflector.Pluralize("octopus")) // will print "octopuses"

Credits

License

This library is distributed under the BSD-style license found in the LICENSE.md file.

Documentation

Overview

Package inflector pluralizes and singularizes English nouns.

There are only two exported functions: `Pluralize` and `Singularize`.

s := "People"
fmt.Println(inflector.Singularize(s)) // will print "Person"

s2 := "octopus"
fmt.Println(inflector.Pluralize(s2)) // will print "octopuses"

Index

Examples

Constants

View Source
const (
	Plural = iota
	Singular
)

Variables

This section is empty.

Functions

func Pluralize

func Pluralize(s string) string

Pluralize returns string s in plural form.

Example
package main

import (
	"fmt"

	"github.com/gedex/inflector"
)

func main() {
	fmt.Println(inflector.Pluralize("octopus"))
}
Output:
octopuses

func Singularize

func Singularize(s string) string

Singularize returns string s in singular form.

Example
package main

import (
	"fmt"

	"github.com/gedex/inflector"
)

func main() {
	fmt.Println(inflector.Singularize("People"))
}
Output:
Person

Types

type InflectorRule

type InflectorRule struct {
	Rules       []*ruleItem
	Irregular   []*irregularItem
	Uninflected []string
	// contains filtered or unexported fields
}

InflectorRule represents inflector rule

type Rule

type Rule int

Rule represents name of the inflector rule, can be Plural or Singular

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址