diff options
author | Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr> | 2013-06-05 17:54:20 +0000 |
---|---|---|
committer | Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr> | 2013-06-05 17:54:20 +0000 |
commit | 504e86d722e67988801ba3e2923a152691c5f79d (patch) | |
tree | 8af76eb97e27748500937dcc7f111da442e9d4a4 /stdlib | |
parent | ad6c2858186c69f7fc85ae1eddcb484b6315b322 (diff) |
Revert r13746 (demanded by Xavier)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13748 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/string.ml | 20 | ||||
-rw-r--r-- | stdlib/string.mli | 18 |
2 files changed, 0 insertions, 38 deletions
diff --git a/stdlib/string.ml b/stdlib/string.ml index 9e4412b3b..fda40b527 100644 --- a/stdlib/string.ml +++ b/stdlib/string.ml @@ -203,23 +203,3 @@ let rcontains_from s i c = type t = string let compare (x: t) (y: t) = Pervasives.compare x y - -(* split a string [s] at every char [c], and return the list of sub-strings *) -let split s c = - let len = length s in - let rec iter pos to_rev = - if pos = len then List.rev ("" :: to_rev) else - match try - Some ( index_from s pos c ) - with Not_found -> None - with - Some pos2 -> - if pos2 = pos then iter (pos+1) ("" :: to_rev) else - iter (pos2+1) ((sub s pos (pos2-pos)) :: to_rev) - | None -> List.rev ( sub s pos (len-pos) :: to_rev ) - in - iter 0 [] - -let cut_at s c = - let pos = index s c in - sub s 0 pos, sub s (pos+1) (length s - pos - 1) diff --git a/stdlib/string.mli b/stdlib/string.mli index 563dba714..14f2c82db 100644 --- a/stdlib/string.mli +++ b/stdlib/string.mli @@ -219,24 +219,6 @@ 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. *) |