summaryrefslogtreecommitdiffstats
path: root/stdlib/string.mli
diff options
context:
space:
mode:
authorFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2013-06-05 13:27:05 +0000
committerFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2013-06-05 13:27:05 +0000
commit1f9f68a328b6c96188ee48430b09ffee754e7b67 (patch)
treecd24383b87f27aaaac7ec1a2e6e43c6ffa8290ae /stdlib/string.mli
parentd940182de56eed2503b2492fac1cab0b607a4877 (diff)
Add String.split and String.cut_at from Misc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13746 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/string.mli')
-rw-r--r--stdlib/string.mli18
1 files changed, 18 insertions, 0 deletions
diff --git a/stdlib/string.mli b/stdlib/string.mli
index 14f2c82db..563dba714 100644
--- a/stdlib/string.mli
+++ b/stdlib/string.mli
@@ -219,6 +219,24 @@ val compare: t -> t -> int
allows the module [String] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)
+val split : string -> char -> string list
+(** [String.split string char] splits the string [string] at every char
+ [char], and returns the list of sub-strings between the chars.
+ [String.concat (String.make 1 c) (String.split s c)] is the identity.
+ @since 4.01
+ *)
+
+val cut_at : string -> char -> string * string
+(** [String.cut_at s c] returns a pair containing the sub-string before
+ the first occurrence of [c] in [s], and the sub-string after the
+ first occurrence of [c] in [s].
+ [let (before, after) = String.cut_at s c in
+ before ^ String.make 1 c ^ after] is the identity if [s] contains [c].
+
+ Raise [Not_found] if the character does not appear in the string
+ @since 4.01
+*)
+
(**/**)
(* The following is for system use only. Do not call directly. *)