Rename String.split to String.split_on_char (#626).
parent
2c96a267dc
commit
d88ac0ac7d
2
Changes
2
Changes
|
@ -59,7 +59,7 @@ OCaml 4.04.0:
|
|||
"transitive" heap size of a value
|
||||
(Alain Frisch, review by Marc Shinwell and Damien Doligez)
|
||||
|
||||
- GPR#626: String.split
|
||||
- GPR#626: String.split_on_char
|
||||
(Alain Frisch)
|
||||
|
||||
- GPR#669: Filename.extension and Filename.remove_extension
|
||||
|
|
|
@ -127,7 +127,7 @@ type t = string
|
|||
let compare (x: t) (y: t) = Pervasives.compare x y
|
||||
external equal : string -> string -> bool = "caml_string_equal"
|
||||
|
||||
let split sep s =
|
||||
let split_on_char sep s =
|
||||
let r = ref [] in
|
||||
let j = ref (length s) in
|
||||
for i = length s - 1 downto 0 do
|
||||
|
|
|
@ -282,7 +282,7 @@ val equal: t -> t -> bool
|
|||
(** The equal function for strings.
|
||||
@since 4.03.0 *)
|
||||
|
||||
val split: char -> string -> string list
|
||||
val split_on_char: char -> string -> string list
|
||||
(** [String.split sep s] returns the list of all (possibly empty)
|
||||
substrings of [s] that are delimited by the [sep] character.
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ if String.escaped raw_string <> ref_string then failwith "test:String.escaped";;
|
|||
|
||||
|
||||
let check_split sep s =
|
||||
let l = String.split sep s in
|
||||
let l = String.split_on_char sep s in
|
||||
assert(List.length l > 0);
|
||||
assert(String.concat (String.make 1 sep) (String.split sep s) = s);
|
||||
assert(String.concat (String.make 1 sep) l = s);
|
||||
List.iter (String.iter (fun c -> assert (c <> sep))) l
|
||||
;;
|
||||
|
||||
|
|
Loading…
Reference in New Issue