aboutsummaryrefslogtreecommitdiff
path: root/clib/cString.ml
diff options
context:
space:
mode:
authorJim Fehrle2020-10-03 11:53:32 -0700
committerJim Fehrle2020-10-03 11:53:32 -0700
commit71fe84d0d6dc8e646332cc5790308de2f8f0fdab (patch)
treeac2a787584ac31e1160e027570faffe7ed9bdf34 /clib/cString.ml
parente596bbb66b8a0ea6fe396315972f7743f8258a97 (diff)
Avoid magic numbers
Diffstat (limited to 'clib/cString.ml')
-rw-r--r--clib/cString.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/clib/cString.ml b/clib/cString.ml
index dcada4c18f..9d2c3729b2 100644
--- a/clib/cString.ml
+++ b/clib/cString.ml
@@ -25,6 +25,7 @@ sig
val ordinal : int -> string
val is_sub : string -> string -> int -> bool
val is_prefix : string -> string -> bool
+ val is_suffix : string -> string -> bool
module Set : Set.S with type elt = t
module Map : CMap.ExtS with type key = t and module Set := Set
module List : CList.MonoS with type elt = t
@@ -105,6 +106,9 @@ let is_sub p s off =
let is_prefix p s =
is_sub p s 0
+let is_suffix p s =
+ is_sub p s (String.length s - String.length p)
+
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"