From 15a3b57db10e61c9de12b5880b04b46db1494b5b Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Thu, 26 Feb 2015 14:31:25 +0100 Subject: Fixing printing of ordinals. --- lib/cString.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/cString.ml') diff --git a/lib/cString.ml b/lib/cString.ml index 250b7cee2d..e9006860fd 100644 --- a/lib/cString.ml +++ b/lib/cString.ml @@ -135,7 +135,14 @@ let plural n s = if n<>1 then s^"s" else s let conjugate_verb_to_be n = if n<>1 then "are" else "is" let ordinal n = - let s = match n mod 10 with 1 -> "st" | 2 -> "nd" | 3 -> "rd" | _ -> "th" in + let s = + if (n / 10) mod 10 = 1 then "th" + else match n mod 10 with + | 1 -> "st" + | 2 -> "nd" + | 3 -> "rd" + | _ -> "th" + in string_of_int n ^ s (* string parsing *) -- cgit v1.2.3