mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2026-03-07 21:27:55 -05:00
CCString(cleanup): remove function always existing in stdlib > 4.08
This commit is contained in:
parent
9eb002304f
commit
b8f1048ce4
3 changed files with 2 additions and 43 deletions
|
|
@ -692,24 +692,11 @@ let of_gen g =
|
||||||
|
|
||||||
let to_iter s k = String.iter k s
|
let to_iter s k = String.iter k s
|
||||||
|
|
||||||
let rec _to_seq s i len () =
|
|
||||||
if len = 0 then
|
|
||||||
Seq.Nil
|
|
||||||
else
|
|
||||||
Seq.Cons (s.[i], _to_seq s (i + 1) (len - 1))
|
|
||||||
|
|
||||||
let to_seq s = _to_seq s 0 (String.length s)
|
|
||||||
|
|
||||||
let of_iter i =
|
let of_iter i =
|
||||||
let b = Buffer.create 32 in
|
let b = Buffer.create 32 in
|
||||||
i (Buffer.add_char b);
|
i (Buffer.add_char b);
|
||||||
Buffer.contents b
|
Buffer.contents b
|
||||||
|
|
||||||
let of_seq seq =
|
|
||||||
let b = Buffer.create 32 in
|
|
||||||
Seq.iter (Buffer.add_char b) seq;
|
|
||||||
Buffer.contents b
|
|
||||||
|
|
||||||
let to_list s = _to_list s [] 0 (String.length s)
|
let to_list s = _to_list s [] 0 (String.length s)
|
||||||
|
|
||||||
let of_list l =
|
let of_list l =
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,6 @@ val to_iter : t -> char iter
|
||||||
(** [to_iter s] returns the [iter] of characters contained in the string [s].
|
(** [to_iter s] returns the [iter] of characters contained in the string [s].
|
||||||
@since 2.8 *)
|
@since 2.8 *)
|
||||||
|
|
||||||
val to_seq : t -> char Seq.t
|
|
||||||
(** [to_seq s] returns the [Seq.t] of characters contained in the string [s].
|
|
||||||
Renamed from [to std_seq] since 3.0.
|
|
||||||
@since 3.0 *)
|
|
||||||
|
|
||||||
val to_list : t -> char list
|
val to_list : t -> char list
|
||||||
(** [to_list s] returns the [list] of characters contained in the string [s]. *)
|
(** [to_list s] returns the [list] of characters contained in the string [s]. *)
|
||||||
|
|
||||||
|
|
@ -98,11 +93,6 @@ val of_iter : char iter -> string
|
||||||
(** [of_iter iter] converts an [iter] of characters to a string.
|
(** [of_iter iter] converts an [iter] of characters to a string.
|
||||||
@since 2.8 *)
|
@since 2.8 *)
|
||||||
|
|
||||||
val of_seq : char Seq.t -> string
|
|
||||||
(** [of_seq seq] converts a [seq] of characters to a string.
|
|
||||||
Renamed from [of_std_seq] since 3.0.
|
|
||||||
@since 3.0 *)
|
|
||||||
|
|
||||||
val of_list : char list -> string
|
val of_list : char list -> string
|
||||||
(** [of_list lc] converts a list of characters [lc] to a string. *)
|
(** [of_list lc] converts a list of characters [lc] to a string. *)
|
||||||
|
|
||||||
|
|
@ -113,7 +103,7 @@ val to_array : string -> char array
|
||||||
(** [to_array s] returns the array of characters contained in the string [s]. *)
|
(** [to_array s] returns the array of characters contained in the string [s]. *)
|
||||||
|
|
||||||
val find : ?start:int -> sub:string -> string -> int
|
val find : ?start:int -> sub:string -> string -> int
|
||||||
(** [find ~start ~sub s] returns the starting index of the first occurrence of [sub] within [s] or [-1].
|
(** [find ~start ~sub s] returns the starting index of the first occurrence of [sub] within [s] or [-1].
|
||||||
@param start starting position in [s]. *)
|
@param start starting position in [s]. *)
|
||||||
|
|
||||||
val find_all : ?start:int -> sub:string -> string -> int gen
|
val find_all : ?start:int -> sub:string -> string -> int gen
|
||||||
|
|
@ -472,10 +462,6 @@ module Split : sig
|
||||||
@since 0.16 *)
|
@since 0.16 *)
|
||||||
end
|
end
|
||||||
|
|
||||||
val split_on_char : char -> string -> string list
|
|
||||||
(** [split_on_char by s] splits the string [s] along the given char [by].
|
|
||||||
@since 1.2 *)
|
|
||||||
|
|
||||||
val split : by:string -> string -> string list
|
val split : by:string -> string -> string list
|
||||||
(** [split ~by s] splits the string [s] along the given string [by].
|
(** [split ~by s] splits the string [s] along the given string [by].
|
||||||
Alias to {!Split.list_cpy}.
|
Alias to {!Split.list_cpy}.
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,6 @@ val to_iter : t -> char iter
|
||||||
(** [to_iter s] returns the [iter] of characters contained in the string [s].
|
(** [to_iter s] returns the [iter] of characters contained in the string [s].
|
||||||
@since 2.8 *)
|
@since 2.8 *)
|
||||||
|
|
||||||
val to_seq : t -> char Seq.t
|
|
||||||
(** [to_seq s] returns the [Seq.t] of characters contained in the string [s].
|
|
||||||
Renamed from [to std_seq] since 3.0.
|
|
||||||
@since 3.0 *)
|
|
||||||
|
|
||||||
val to_list : t -> char list
|
val to_list : t -> char list
|
||||||
(** [to_list s] returns the [list] of characters contained in the string [s]. *)
|
(** [to_list s] returns the [list] of characters contained in the string [s]. *)
|
||||||
|
|
||||||
|
|
@ -103,11 +98,6 @@ val of_iter : char iter -> string
|
||||||
(** [of_iter iter] converts an [iter] of characters to a string.
|
(** [of_iter iter] converts an [iter] of characters to a string.
|
||||||
@since 2.8 *)
|
@since 2.8 *)
|
||||||
|
|
||||||
val of_seq : char Seq.t -> string
|
|
||||||
(** [of_seq seq] converts a [seq] of characters to a string.
|
|
||||||
Renamed from [of_std_seq] since 3.0.
|
|
||||||
@since 3.0 *)
|
|
||||||
|
|
||||||
val of_list : char list -> string
|
val of_list : char list -> string
|
||||||
(** [of_list lc] converts a list of characters [lc] to a string. *)
|
(** [of_list lc] converts a list of characters [lc] to a string. *)
|
||||||
|
|
||||||
|
|
@ -118,7 +108,7 @@ val to_array : string -> char array
|
||||||
(** [to_array s] returns the array of characters contained in the string [s]. *)
|
(** [to_array s] returns the array of characters contained in the string [s]. *)
|
||||||
|
|
||||||
val find : ?start:int -> sub:(string[@keep_label]) -> string -> int
|
val find : ?start:int -> sub:(string[@keep_label]) -> string -> int
|
||||||
(** [find ?start ~sub s] returns the starting index of the first occurrence of [sub] within [s] or [-1].
|
(** [find ?start ~sub s] returns the starting index of the first occurrence of [sub] within [s] or [-1].
|
||||||
@param start starting position in [s]. *)
|
@param start starting position in [s]. *)
|
||||||
|
|
||||||
val find_all : ?start:int -> sub:(string[@keep_label]) -> string -> int gen
|
val find_all : ?start:int -> sub:(string[@keep_label]) -> string -> int gen
|
||||||
|
|
@ -512,10 +502,6 @@ module Split : sig
|
||||||
@since 0.16 *)
|
@since 0.16 *)
|
||||||
end
|
end
|
||||||
|
|
||||||
val split_on_char : by:char -> string -> string list
|
|
||||||
(** [split_on_char ~by s] splits the string [s] along the given char [by].
|
|
||||||
@since 1.2 *)
|
|
||||||
|
|
||||||
val split : by:(string[@keep_label]) -> string -> string list
|
val split : by:(string[@keep_label]) -> string -> string list
|
||||||
(** [split ~by s] splits the string [s] along the given string [by].
|
(** [split ~by s] splits the string [s] along the given string [by].
|
||||||
Alias to {!Split.list_cpy}.
|
Alias to {!Split.list_cpy}.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue