mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 03:35:30 -05:00
CCString.init
This commit is contained in:
parent
4ca1295c44
commit
783331b037
2 changed files with 9 additions and 0 deletions
|
|
@ -56,6 +56,11 @@ let compare = String.compare
|
|||
|
||||
let hash s = Hashtbl.hash s
|
||||
|
||||
let init n f =
|
||||
let s = String.make n ' ' in
|
||||
for i = 0 to n-1 do s.[i] <- f i done;
|
||||
s
|
||||
|
||||
let length = String.length
|
||||
|
||||
let rec _to_list s acc i len =
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ val compare : t -> t -> int
|
|||
|
||||
val hash : t -> int
|
||||
|
||||
val init : int -> (int -> char) -> t
|
||||
(** Analog to [Array.init].
|
||||
@since NEXT_VERSION *)
|
||||
|
||||
val of_gen : char gen -> t
|
||||
val of_seq : char sequence -> t
|
||||
val of_klist : char klist -> t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue