package english

import "github.com/dustin/go-humanize/english"

Package english provides utilities to generate more user-friendly English output.

Index

Functions

func OxfordWordSeries

func OxfordWordSeries(words []string, conjunction string) string

OxfordWordSeries converts a list of words into a word series in English, using an Oxford comma (https://en.wikipedia.org/wiki/Serial_comma). It returns a string containing all the given words separated by commas, the coordinating conjunction, and a serial comma, as appropriate.

func Plural

func Plural(quantity int, singular, plural string) string

Plural formats an integer and a string into a single pluralized string. The simple English rules of regular pluralization will be used if the plural form is an empty string (i.e. not explicitly given).

func PluralWord

func PluralWord(quantity int, singular, plural string) string

PluralWord builds the plural form of an English word. The simple English rules of regular pluralization will be used if the plural form is an empty string (i.e. not explicitly given). The special cases are not guaranteed to work for strings outside ASCII.

func WordSeries

func WordSeries(words []string, conjunction string) string

WordSeries converts a list of words into a word series in English. It returns a string containing all the given words separated by commas, the coordinating conjunction, and a serial comma, as appropriate.

Source Files

words.go

Version
v1.0.1 (latest)
Published
Jan 10, 2023
Platform
linux/amd64
Imports
3 packages
Last checked
5 days ago

Tools for package owners.