diff options
author | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2014-11-13 20:16:16 +0100 |
---|---|---|
committer | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2014-11-13 21:40:37 +0100 |
commit | a71f4ec540ed75310ac1077d93aacf1d60bf308d (patch) | |
tree | 57652da2832c84d1895cbc13494a595e402ebfa1 /lib | |
parent | 014e5ac92a2338f8820be63618c5b0dd631744de (diff) |
Move conjugate_verb_to_be next to cString.plural.
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. *) |