Discover Packages
github.com/bfontaine/english
package
module
Version:
v0.0.0-...-dfc980f
Opens a new window with list of versions in this module.
Published: Sep 23, 2015
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
English
English is a Go library for pretty-printing values in English.
Install
go get github.com/bfontaine/english
Usage
english.Bool(...) returns "yes" for true and "no" for false
english.OrdinalLiteral(...) returns an ordinal literal, e.g. "1st" for
1, "123rd" for 123, etc.
english.Plural(word, count) returns word either as is or with an s
appended if count is different than 1.
I only implemented the functions I needed; which is why there are only three of
them for now.
Expand ▾
Collapse ▴
Documentation
¶
Package english provides utilities for pretty-printing values in English
Bool returns either "yes" (true) or "no" (false)
OrdinalLiteral returns an ordinal version of the given number.
E.g.: 1st, 2nd, 123rd, 4916th.
Plural is a simple utility which takes a word and a quantity, and returns
the pluralized version of the word if necessary. It doesn’t support special
cases (e.g. Plural("woman", 2) will return "womans") but makes code more
readable in the general case.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.