2023-10-06 17:21:24 +00:00
|
|
|
|
2023-03-01 17:45:05 +00:00
|
|
|
# go-ord
|
|
|
|
|
|
|
|
Package **ord** provides tools for turning numbers into their human-friendly ordinal representation.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
| Number | (English) Ordinal |
|
|
|
|
|--------|-------------------|
|
|
|
|
| 1 | 1st |
|
|
|
|
| 2 | 2nd |
|
|
|
|
| 3 | 3rd |
|
|
|
|
| 4 | 4th |
|
|
|
|
| 5 | 5th |
|
|
|
|
| ... | ... |
|
|
|
|
| 20 | 20th |
|
|
|
|
| 21 | 21st |
|
|
|
|
| 22 | 22nd |
|
|
|
|
| 23 | 23rd |
|
|
|
|
| 24 | 24th |
|
|
|
|
| 25 | 25th |
|
|
|
|
| 26 | 26th |
|
|
|
|
| 27 | 27th |
|
|
|
|
| ... | ... |
|
|
|
|
|
|
|
|
## Documention
|
|
|
|
|
2023-10-06 17:21:24 +00:00
|
|
|
Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-ord
|
2023-03-01 17:45:05 +00:00
|
|
|
|
2023-10-06 17:21:24 +00:00
|
|
|
[![GoDoc](https://godoc.org/sourcecode.social/reiver/go-ord?status.svg)](https://godoc.org/sourcecode.social/reiver/go-ord)
|
2023-03-01 17:45:05 +00:00
|
|
|
|
|
|
|
## Example:
|
|
|
|
|
|
|
|
```go
|
2023-10-06 17:21:24 +00:00
|
|
|
import "sourcecode.social/reiver/go-ord/en"
|
2023-03-01 17:45:05 +00:00
|
|
|
|
|
|
|
// ...
|
|
|
|
|
|
|
|
var n int64 = 123
|
|
|
|
|
|
|
|
fmt.Printf("You are the %s person in line.", orden.FormatInt64(n))
|
|
|
|
|
|
|
|
// Output:
|
|
|
|
// You are the 123rd person in line.
|
|
|
|
```
|
2023-10-06 17:21:24 +00:00
|
|
|
|
|
|
|
## Import
|
|
|
|
|
2023-10-06 17:22:39 +00:00
|
|
|
To import package **ord** use `import` code like the follownig:
|
2023-10-06 17:21:24 +00:00
|
|
|
```
|
|
|
|
import "sourcecode.social/reiver/go-ord"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
2023-10-06 17:22:39 +00:00
|
|
|
To install package **ord** do the following:
|
2023-10-06 17:21:24 +00:00
|
|
|
```
|
2023-10-27 18:32:37 +00:00
|
|
|
GOPROXY=direct go get https://sourcecode.social/reiver/go-ord
|
2023-10-06 17:21:24 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Author
|
|
|
|
|
2023-10-06 17:22:39 +00:00
|
|
|
Package **ord** was written by [Charles Iliya Krempeaux](http://changelog.ca)
|