Debian Codegraph @

clib/cString.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (** Module type [S] is the one from OCaml Stdlib. *)
12 module type S = module type of String
13
14 include S
15 (** We include the standard library *)
16
17 (** Equality on strings *)
18
19 val hash : string -> int
20 (** Hashing on strings. Should be compatible with generic one. *)
21
22 val is_empty : string -> bool
23 (** Test whether a string is empty. *)
24
25 val explode : string -> string list
26 (** [explode "x1...xn"] returns [["x1"; ...; "xn"]] *)
27
28 val implode : string list -> string
29 (** [implode [s1; ...; sn]] returns [s1 ^ ... ^ sn] *)
30
31 val drop_simple_quotes : string -> string
32 (** Remove the eventual first surrounding simple quotes of a string. *)
33
34 val quote_coq_string : string -> string
35 (** Quote a string according to Rocq conventions (i.e. doubling
36 double quotes and surrounding by double quotes) *)
37
38 val unquote_coq_string : string -> string option
39 (** Unquote a quoted string according to Rocq conventions
40 (i.e. removing surrounding double quotes and undoubling double
41 quotes); returns [None] if not a quoted string *)
42
43 val html_escape : string -> string
44 (** replace HTML reserved characters with escape sequences,
45 e.g. `&` -> "&#38;" *)
46
47 val string_index_from : string -> int -> string -> int
48 (** As [index_from], but takes a string instead of a char as pattern argument *)
49
50 val string_contains : where:string -> what:string -> bool
51 (** As [contains], but takes a string instead of a char as pattern argument *)
52
53 val plural : int -> string -> string
54 (** [plural n s] adds a optional 's' to the [s] when [2 <= n]. *)
55
56 val lplural : _ list -> string -> string
57 (** [lplural l s] is [plural (List.length l) s]. *)
58
59 val conjugate_verb_to_be : int -> string
60 (** [conjugate_verb_to_be] returns "is" when [n=1] and "are" otherwise *)
61
62 val ordinal : int -> string
63 (** Generate the ordinal number in English. *)
64
65 val is_sub : string -> string -> int -> bool
66 (** [is_sub p s off] tests whether [s] contains [p] at offset [off]. *)
67
68 val is_prefix : string -> string -> bool
69 (** [is_prefix p s] tests whether [p] is a prefix of [s]. *)
70
71 val is_suffix : string -> string -> bool
72 (** [is_suffix suf s] tests whether [suf] is a suffix of [s]. *)
73
74 val edit_distance : ?limit:int -> string -> string -> int
75 (** [edit_distance s0 s1] is the number of single character edits
76 (understood as insertion, deletion, substitution, transposition)
77 that are needed to change [s0] into [s1].
78
79 If [limit] is provided the function returns with [limit] as soon
80 as it was determined that [s0] and [s1] have distance of at least
81 [limit]. This is faster if you have a fixed limit, for example for
82 spellchecking.
83
84 copied from ocaml 5.4 *)
85
86 (** {6 Generic operations} **)
87
88 module Set : CSet.ExtS with type elt = t
89 (** Finite sets on [string] *)
90
91 module Map : CMap.ExtS with type key = t and module Set := Set
92 (** Finite maps on [string] *)
93
94 module Pred : Predicate.S with type elt = t
95
96 module List : CList.MonoS with type elt = t
97 (** Association lists with [string] as keys *)
98
99 val hcons : string Hashcons.f
100 (** Hashconsing on [string] *)