diff options
| author | Pierre-Marie Pédrot | 2019-09-11 11:24:58 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2019-09-11 11:24:58 +0200 |
| commit | 4debcab8771f0c2f52b7697dbf2233f931f863e6 (patch) | |
| tree | 0a44d70147f4895a2336e4e31ceb3a5990429010 /clib | |
| parent | 53329af20869a2c18c9ffa99546238134371f6e8 (diff) | |
| parent | bc10e4566cefcab6449fb97b47cf23a431c5e8bb (diff) | |
Merge PR #8567: More general support for installation of coqide keys
Ack-by: SkySkimmer
Reviewed-by: Zimmi48
Reviewed-by: ejgallego
Reviewed-by: gares
Ack-by: ppedrot
Diffstat (limited to 'clib')
| -rw-r--r-- | clib/cString.ml | 4 | ||||
| -rw-r--r-- | clib/cString.mli | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/clib/cString.ml b/clib/cString.ml index 60915efe86..99fb7d2b78 100644 --- a/clib/cString.ml +++ b/clib/cString.ml @@ -24,6 +24,7 @@ sig val conjugate_verb_to_be : int -> string val ordinal : int -> string val is_sub : string -> string -> int -> bool + val is_prefix : 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 @@ -101,6 +102,9 @@ let is_sub p s off = in aux 0 +let is_prefix p s = + is_sub p s 0 + 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" diff --git a/clib/cString.mli b/clib/cString.mli index 8a4fe62a1c..d02be2d15f 100644 --- a/clib/cString.mli +++ b/clib/cString.mli @@ -51,6 +51,9 @@ sig val is_sub : string -> string -> int -> bool (** [is_sub p s off] tests whether [s] contains [p] at offset [off]. *) + val is_prefix : string -> string -> bool + (** [is_prefix p s] tests whether [p] is a prefix of [s]. *) + (** {6 Generic operations} **) module Set : Set.S with type elt = t |
