summaryrefslogtreecommitdiff
path: root/stdlib/string.mli
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2014-08-06 15:57:38 +0000
committerGabriel Scherer <gabriel.scherer@gmail.com>2014-08-06 15:57:38 +0000
commitb7dd6d2c91df5eefdbd41981c18655f198ff7c4d (patch)
tree4b9123ea0245afbc6055b463d7db4761ae867be0 /stdlib/string.mli
parent97b302a1ce750c5fc1a5bd24283e2a8dbf1fe402 (diff)
downloadocaml-b7dd6d2c91df5eefdbd41981c18655f198ff7c4d.tar.gz
implement {Bytes,String}.mapi
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15058 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/string.mli')
-rw-r--r--stdlib/string.mli24
1 files changed, 17 insertions, 7 deletions
diff --git a/stdlib/string.mli b/stdlib/string.mli
index 3cfccd1f2d..da6d8351af 100644
--- a/stdlib/string.mli
+++ b/stdlib/string.mli
@@ -81,10 +81,14 @@ val make : int -> char -> string
Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. *)
val init : int -> (int -> char) -> string
-(** [String.init n f] returns a string of length [n],
- with character [i] initialized to the result of [f i].
+(** [String.init n f] returns a string of length [n], with character
+ [i] initialized to the result of [f i] (called in increasing
+ index order).
- Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. *)
+ Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}.
+
+ @since 4.02.0
+*)
val copy : string -> string
(** Return a copy of the given string. *)
@@ -131,10 +135,16 @@ val iteri : (int -> char -> unit) -> string -> unit
@since 4.00.0 *)
val map : (char -> char) -> string -> string
-(** [String.map f s] applies function [f] in turn to all
- the characters of [s] and stores the results in a new string that
- is returned.
- @since 4.00.0 *)
+(** [String.map f s] applies function [f] in turn to all the
+ characters of [s] (in increasing index order) and stores the
+ results in a new string that is returned.
+ @since 4.00.0 *)
+
+val mapi : (int -> char -> char) -> string -> string
+(** [String.mapi f s] calls [f] with each character of [s] and its
+ index (in increasing index order) and stores the results in a new
+ string that is returned.
+ @since 4.02.0 *)
val trim : string -> string
(** Return a copy of the argument, without leading and trailing