Adding String.iteri.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10762 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
a5628ad725
commit
f537ba28b0
|
@ -60,6 +60,9 @@ let blit s1 ofs1 s2 ofs2 len =
|
|||
let iter f a =
|
||||
for i = 0 to length a - 1 do f(unsafe_get a i) done
|
||||
|
||||
let iteri f a =
|
||||
for i = 0 to length a - 1 do f i (unsafe_get a i) done
|
||||
|
||||
let concat sep l =
|
||||
match l with
|
||||
[] -> ""
|
||||
|
|
|
@ -94,6 +94,13 @@ val iter : (char -> unit) -> string -> unit
|
|||
the characters of [s]. It is equivalent to
|
||||
[f s.[0]; f s.[1]; ...; f s.[String.length s - 1]; ()]. *)
|
||||
|
||||
val iteri : (int -> char -> unit) -> string -> unit
|
||||
(** Same as {!String.iter}, but the
|
||||
function is applied to the index of the element as first argument (counting from 0),
|
||||
and the character itself as second argument.
|
||||
@since 3.13.0
|
||||
*)
|
||||
|
||||
val escaped : string -> string
|
||||
(** Return a copy of the argument, with special characters
|
||||
represented by escape sequences, following the lexical
|
||||
|
|
|
@ -84,6 +84,13 @@ val iter : f:(char -> unit) -> string -> unit
|
|||
the characters of [s]. It is equivalent to
|
||||
[f s.[0]; f s.[1]; ...; f s.[String.length s - 1]; ()]. *)
|
||||
|
||||
val iteri : f:(int -> char -> unit) -> string -> unit
|
||||
(** Same as {!String.iter}, but the
|
||||
function is applied to the index of the element as first argument (counting from 0),
|
||||
and the character itself as second argument.
|
||||
@since 3.13.0
|
||||
*)
|
||||
|
||||
val escaped : string -> string
|
||||
(** Return a copy of the argument, with special characters
|
||||
represented by escape sequences, following the lexical
|
||||
|
|
Loading…
Reference in New Issue