inflect

package module
v0.0.0-...-e234d1e Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2016 License: MIT Imports: 6 Imported by: 3

README

inflect

Circle CI Build Status Coverage Status GoDoc Go Report Card

Installing

go get

$ go get -u github.com/martinusso/inflect

Using

IntoWords()

IntoWords convert numbers (float64) to words

func IntoWords(number float64) string 
got := IntoWords(42)  // -> forty-two
got := IntoWords(-147)  // -> Minus one hundred and forty-seven
IsConsonant

IsConsonant check if a character is a consonant

func IsConsonant(s string) bool
IsVowel

IsVowel check if a character is a vowel

func IsVowel(s string) bool
Ordinal

Ordinal returns the ordinal suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th...

func Ordinal(number int) string
got := Ordinal(-1)  // -> st
got := Ordinal(42)  // -> nd
Ordinalize

Ordinalize turns a number into an ordinal string

func Ordinalize(number int) string
got := Ordinal(-1)  // -> -1st
got := Ordinal(42)  // -> 42nd
Parameterize

Parameterize replaces special characters in a pretty string

func Parameterize(s string) string
got := Parameterize("J. R. R. Tolkien")  // -> "j-r-r-tolkien"
ParameterizeSep

ParameterizeSep replaces special characters, according to the separator, in a string

func ParameterizeSep(s, sep string) string
got := ParameterizeSep("J. R. R. Tolkien", "_")  // -> "j_r_r_tolkien"
Pluralize

Pluralize generates the plurals of nouns

func Pluralize(word string) string
got := Plural("word") // -> words
got := Plural("noun") // -> nouns

License

This software is open source, licensed under the The MIT License (MIT). See LICENSE for details.

Documentation

Overview

Package inflect generate plurals of nouns, ordinals; ordinalize numbers; parameterize/transliterate strings and convert numbers to words

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Camelize

func Camelize(s string) string

Camelize converts strings to UpperCamelCase

func IntoWords

func IntoWords(number float64) string

IntoWords convert numbers (float64) to words

func IsConsonant

func IsConsonant(s string) bool

IsConsonant check if a character is a consonant

func IsVowel

func IsVowel(s string) bool

IsVowel check if a character is a vowel

func LowerCamelize

func LowerCamelize(s string) string

LowerCamelize converts strings to lowerCamelCase

func Ordinal

func Ordinal(number int) string

Ordinal returns the ordinal suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th...

func Ordinalize

func Ordinalize(number int) string

Ordinalize turns a number into an ordinal string

func Parameterize

func Parameterize(s string) string

Parameterize replaces special characters in a pretty string

func ParameterizeSep

func ParameterizeSep(s, sep string) string

ParameterizeSep replaces special characters, according to the separator, in a string

func Pluralize

func Pluralize(word string) string

Pluralize generates the plurals of nouns

func Transliterate

func Transliterate(word string) string

Transliterate replaces non-ASCII characters with an ASCII approximation, or if none exists, to “?”.

func Underscore

func Underscore(s string) string

Underscore makes an underscored/lowercase string

Types

This section is empty.

Jump to

Keyboard shortcuts

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