diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cString.ml | 3 | ||||
-rw-r--r-- | lib/cString.mli | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/cString.ml b/lib/cString.ml index 5c857077a..13ec4e9b7 100644 --- a/lib/cString.ml +++ b/lib/cString.ml @@ -22,6 +22,7 @@ sig val string_index_from : string -> int -> string -> int val string_contains : where:string -> what:string -> bool val plural : int -> string -> string + val conjugate_verb_to_be : int -> string val ordinal : int -> string val split : char -> string -> string list val is_sub : string -> string -> int -> bool @@ -131,6 +132,8 @@ let is_sub p s off = 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 string_of_int n ^ s diff --git a/lib/cString.mli b/lib/cString.mli index 6aa10875c..d7afd1316 100644 --- a/lib/cString.mli +++ b/lib/cString.mli @@ -47,6 +47,9 @@ sig val plural : int -> string -> string (** [plural n s] adds a optional 's' to the [s] when [2 <= n]. *) + val conjugate_verb_to_be : int -> string + (** [conjugate_verb_to_be] returns "is" when [n=1] and "are" otherwise *) + val ordinal : int -> string (** Generate the ordinal number in English. *) |