aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dustin/go-humanize/ordinals.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2023-12-29 21:31:53 +0100
committerLibravatar Rutger Broekhoff2023-12-29 21:31:53 +0100
commit404aeae4545d2426c089a5f8d5e82dae56f5212b (patch)
tree2d84e00af272b39fc04f3795ae06bc48970e57b5 /vendor/github.com/dustin/go-humanize/ordinals.go
parent209d8b0187ed025dec9ac149ebcced3462877bff (diff)
downloadgitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.tar.gz
gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.zip
Make Nix builds work
Diffstat (limited to 'vendor/github.com/dustin/go-humanize/ordinals.go')
-rw-r--r--vendor/github.com/dustin/go-humanize/ordinals.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/github.com/dustin/go-humanize/ordinals.go b/vendor/github.com/dustin/go-humanize/ordinals.go
new file mode 100644
index 0000000..43d88a8
--- /dev/null
+++ b/vendor/github.com/dustin/go-humanize/ordinals.go
@@ -0,0 +1,25 @@
1package humanize
2
3import "strconv"
4
5// Ordinal gives you the input number in a rank/ordinal format.
6//
7// Ordinal(3) -> 3rd
8func Ordinal(x int) string {
9 suffix := "th"
10 switch x % 10 {
11 case 1:
12 if x%100 != 11 {
13 suffix = "st"
14 }
15 case 2:
16 if x%100 != 12 {
17 suffix = "nd"
18 }
19 case 3:
20 if x%100 != 13 {
21 suffix = "rd"
22 }
23 }
24 return strconv.Itoa(x) + suffix
25}