Last active
January 1, 2023 19:30
-
-
Save jchannon/79a8f26b1fdfda4621b1ab4df7b47b7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type System.Int32 with | |
member x.DisplayWithSuffix() = | |
let f = x.ToString() | |
let defaultVal = f + "th" | |
let mutable result = "" | |
result <- if f.EndsWith("11") then f + "th" else defaultVal | |
result <- if f.EndsWith("12") then f + "th" else defaultVal | |
result <- if f.EndsWith("13") then f + "th" else defaultVal | |
result <- if f.EndsWith("1") then f + "st" else defaultVal | |
result <- if f.EndsWith("2") then f + "nd" else defaultVal | |
result <- if f.EndsWith("3") then f + "rd" else defaultVal | |
result |
ijrussell
commented
Jan 1, 2023
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment