mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
clean(String): remove functions defined in Stdlib
This commit is contained in:
parent
baec1f466e
commit
c59147f1d1
3 changed files with 0 additions and 99 deletions
|
|
@ -10,33 +10,6 @@ type 'a gen = unit -> 'a option
|
||||||
type 'a sequence = ('a -> unit) -> unit
|
type 'a sequence = ('a -> unit) -> unit
|
||||||
type 'a klist = unit -> [`Nil | `Cons of 'a * 'a klist]
|
type 'a klist = unit -> [`Nil | `Cons of 'a * 'a klist]
|
||||||
|
|
||||||
(* compatibility implementations *)
|
|
||||||
|
|
||||||
let init n f =
|
|
||||||
let buf = Bytes.init n f in
|
|
||||||
Bytes.unsafe_to_string buf
|
|
||||||
|
|
||||||
(*$T
|
|
||||||
init 3 (fun i -> [|'a'; 'b'; 'c'|].(i)) = "abc"
|
|
||||||
init 0 (fun _ -> assert false) = ""
|
|
||||||
*)
|
|
||||||
|
|
||||||
let uppercase_ascii = String.map CCChar.uppercase_ascii
|
|
||||||
|
|
||||||
let lowercase_ascii = String.map CCChar.lowercase_ascii
|
|
||||||
|
|
||||||
let mapi f s = init (String.length s) (fun i -> f i s.[i])
|
|
||||||
|
|
||||||
let capitalize_ascii s =
|
|
||||||
mapi
|
|
||||||
(fun i c -> if i=0 then CCChar.uppercase_ascii c else c)
|
|
||||||
s
|
|
||||||
|
|
||||||
let uncapitalize_ascii s =
|
|
||||||
mapi
|
|
||||||
(fun i c -> if i=0 then CCChar.lowercase_ascii c else c)
|
|
||||||
s
|
|
||||||
|
|
||||||
(* standard implementations *)
|
(* standard implementations *)
|
||||||
|
|
||||||
include String
|
include String
|
||||||
|
|
@ -100,8 +73,6 @@ module type S = sig
|
||||||
Renamed from [print] since 2.0. *)
|
Renamed from [print] since 2.0. *)
|
||||||
end
|
end
|
||||||
|
|
||||||
let equal (a:string) b = Stdlib.(=) a b
|
|
||||||
|
|
||||||
let compare_int (a : int) b = Stdlib.compare a b
|
let compare_int (a : int) b = Stdlib.compare a b
|
||||||
let compare = String.compare
|
let compare = String.compare
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,6 @@ end
|
||||||
|
|
||||||
include module type of struct include String end
|
include module type of struct include String end
|
||||||
|
|
||||||
val equal : string -> string -> bool
|
|
||||||
(** Equality function on strings. *)
|
|
||||||
|
|
||||||
val compare : string -> string -> int
|
val compare : string -> string -> int
|
||||||
|
|
||||||
val is_empty : string -> bool
|
val is_empty : string -> bool
|
||||||
|
|
@ -93,10 +90,6 @@ val is_empty : string -> bool
|
||||||
|
|
||||||
val hash : string -> int
|
val hash : string -> int
|
||||||
|
|
||||||
val init : int -> (int -> char) -> string
|
|
||||||
(** Like [Array.init].
|
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val rev : string -> string
|
val rev : string -> string
|
||||||
(** [rev s] returns the reverse of [s].
|
(** [rev s] returns the reverse of [s].
|
||||||
@since 0.17 *)
|
@since 0.17 *)
|
||||||
|
|
@ -244,18 +237,6 @@ val iter : (char -> unit) -> string -> unit
|
||||||
(** Alias to {!String.iter}.
|
(** Alias to {!String.iter}.
|
||||||
@since 0.12 *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val iteri : (int -> char -> unit) -> string -> unit
|
|
||||||
(** Iter on chars with their index.
|
|
||||||
@since 0.12 *)
|
|
||||||
|
|
||||||
val map : (char -> char) -> string -> string
|
|
||||||
(** Map chars.
|
|
||||||
@since 0.12 *)
|
|
||||||
|
|
||||||
val mapi : (int -> char -> char) -> string -> string
|
|
||||||
(** Map chars with their index.
|
|
||||||
@since 0.12 *)
|
|
||||||
|
|
||||||
val filter_map : (char -> char option) -> string -> string
|
val filter_map : (char -> char option) -> string -> string
|
||||||
(** [filter_map f s] calls [(f a0) (f a1) ... (f an)] where [a0 ... an] are the characters of s.
|
(** [filter_map f s] calls [(f a0) (f a1) ... (f an)] where [a0 ... an] are the characters of s.
|
||||||
It returns the string of characters [ci] such as [f ai = Some ci] (when [f] returns [None],
|
It returns the string of characters [ci] such as [f ai = Some ci] (when [f] returns [None],
|
||||||
|
|
@ -336,22 +317,6 @@ val exists2 : (char -> char -> bool) -> string -> string -> bool
|
||||||
Those functions are deprecated in {!String} since 4.03, so we provide
|
Those functions are deprecated in {!String} since 4.03, so we provide
|
||||||
a stable alias for them even in older versions. *)
|
a stable alias for them even in older versions. *)
|
||||||
|
|
||||||
val capitalize_ascii : string -> string
|
|
||||||
(** See {!String}.
|
|
||||||
@since 0.18 *)
|
|
||||||
|
|
||||||
val uncapitalize_ascii : string -> string
|
|
||||||
(** See {!String}.
|
|
||||||
@since 0.18 *)
|
|
||||||
|
|
||||||
val uppercase_ascii : string -> string
|
|
||||||
(** See {!String}.
|
|
||||||
@since 0.18 *)
|
|
||||||
|
|
||||||
val lowercase_ascii : string -> string
|
|
||||||
(** See {!String}.
|
|
||||||
@since 0.18 *)
|
|
||||||
|
|
||||||
val equal_caseless : string -> string -> bool
|
val equal_caseless : string -> string -> bool
|
||||||
(** Comparison without respect to {b ascii} lowercase.
|
(** Comparison without respect to {b ascii} lowercase.
|
||||||
@since 1.2 *)
|
@since 1.2 *)
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,6 @@ end
|
||||||
|
|
||||||
include module type of struct include StringLabels end
|
include module type of struct include StringLabels end
|
||||||
|
|
||||||
val equal : string -> string -> bool
|
|
||||||
(** Equality function on strings. *)
|
|
||||||
|
|
||||||
val compare : string -> string -> int
|
val compare : string -> string -> int
|
||||||
|
|
||||||
val is_empty : string -> bool
|
val is_empty : string -> bool
|
||||||
|
|
@ -90,10 +87,6 @@ val is_empty : string -> bool
|
||||||
|
|
||||||
val hash : string -> int
|
val hash : string -> int
|
||||||
|
|
||||||
val init : int -> (int -> char) -> string
|
|
||||||
(** Like [Array.init].
|
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val rev : string -> string
|
val rev : string -> string
|
||||||
(** [rev s] returns the reverse of [s].
|
(** [rev s] returns the reverse of [s].
|
||||||
@since 0.17 *)
|
@since 0.17 *)
|
||||||
|
|
@ -241,18 +234,6 @@ val iter : f:(char -> unit) -> string -> unit
|
||||||
(** Alias to {!String.iter}.
|
(** Alias to {!String.iter}.
|
||||||
@since 0.12 *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val iteri : f:(int -> char -> unit) -> string -> unit
|
|
||||||
(** Iter on chars with their index.
|
|
||||||
@since 0.12 *)
|
|
||||||
|
|
||||||
val map : f:(char -> char) -> string -> string
|
|
||||||
(** Map chars.
|
|
||||||
@since 0.12 *)
|
|
||||||
|
|
||||||
val mapi : f:(int -> char -> char) -> string -> string
|
|
||||||
(** Map chars with their index.
|
|
||||||
@since 0.12 *)
|
|
||||||
|
|
||||||
val filter_map : f:(char -> char option) -> string -> string
|
val filter_map : f:(char -> char option) -> string -> string
|
||||||
(** [filter_map f s] calls [(f a0) (f a1) ... (f an)] where [a0 ... an] are the characters of s.
|
(** [filter_map f s] calls [(f a0) (f a1) ... (f an)] where [a0 ... an] are the characters of s.
|
||||||
It returns the string of characters [ci] such as [f ai = Some ci] (when [f] returns [None],
|
It returns the string of characters [ci] such as [f ai = Some ci] (when [f] returns [None],
|
||||||
|
|
@ -333,22 +314,6 @@ val exists2 : f:(char -> char -> bool) -> string -> string -> bool
|
||||||
Those functions are deprecated in {!String} since 4.03, so we provide
|
Those functions are deprecated in {!String} since 4.03, so we provide
|
||||||
a stable alias for them even in older versions. *)
|
a stable alias for them even in older versions. *)
|
||||||
|
|
||||||
val capitalize_ascii : string -> string
|
|
||||||
(** See {!String}.
|
|
||||||
@since 0.18 *)
|
|
||||||
|
|
||||||
val uncapitalize_ascii : string -> string
|
|
||||||
(** See {!String}.
|
|
||||||
@since 0.18 *)
|
|
||||||
|
|
||||||
val uppercase_ascii : string -> string
|
|
||||||
(** See {!String}.
|
|
||||||
@since 0.18 *)
|
|
||||||
|
|
||||||
val lowercase_ascii : string -> string
|
|
||||||
(** See {!String}.
|
|
||||||
@since 0.18 *)
|
|
||||||
|
|
||||||
val equal_caseless : string -> string -> bool
|
val equal_caseless : string -> string -> bool
|
||||||
(** Comparison without respect to {b ascii} lowercase.
|
(** Comparison without respect to {b ascii} lowercase.
|
||||||
@since 1.2 *)
|
@since 1.2 *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue