Skip to content

suft/numeral

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numeral

golang go-mod size

A numeral utility package for Go

Installation

To install the numeral library run:

go get github.com/suft/numeral

Usage

Ordinal

numeral.Ordinal is a function that returns the English ordinal letters following a numeral.

With error checking

package main

import (
    "fmt"
    "os"

    "github.com/suft/numeral"
)

func main() {
    visitor, err := numeral.Ordinal(2)
    if err != nil {
      return fmt.Fprintf(os.Stderr, "invalid value")
      os.Exit(1)
    }
    fmt.Printf("You are the %s visitor", visitor)
}
You are the 2nd visitor

Without error checking

package main

import (
    "fmt"

    "github.com/suft/numeral"
)

func main() {
    visitor, _ := numeral.Ordinal(3)
    fmt.Printf("You are the %s visitor", visitor)
}
You are the 3rd visitor

Issues

If you encounter any problems, please file an issue along with a detailed description.

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps.

License

mit

Distributed under the terms of the MIT license, numeral is free and open source software.

About

A numeral utility package for Go

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages