Source file mimestring.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
open Core.Core_stable
(** Case-insensitive strings *)
module Case_insensitive = struct
module Stable = struct
module V1 = struct
type t = String.V1.t [@@deriving sexp, bin_io]
let compare = Core.String.Caseless.compare
let comparator = Core.String.Caseless.comparator
type comparator_witness = Core.String.Caseless.comparator_witness
let hash = Core.String.Caseless.hash
let hash_fold_t = Core.String.Caseless.hash_fold_t
end
end
open Core
include String.Caseless
let of_string = Fn.id
let to_string = Fn.id
let to_lowercase_string = String.lowercase
let equal_string = equal
end
open Core
module type S = sig
type t [@@deriving sexp]
val of_string : string -> t
val to_lowercase_string : t -> string
val equal_string : t -> string -> bool
include Comparable.S_plain with type t := t
include Hashable.S_plain with type t := t
end
let quote_escape =
unstage (String.Escaping.escape ~escapeworthy:[ '"'; '\\' ] ~escape_char:'\\')
;;
let quote str = String.concat [ "\""; quote_escape str; "\"" ]