Module CCString.Split

type drop_if_empty = {
first : bool;
last : bool;
}

Specification of what to do with empty blocks, as in split ~by:"-" "-a-b-".

The default value of all remaining functions is Drop_none.

val no_drop : drop_if_empty

Do not drop any group, even empty and on borders.

val list_ : ?⁠drop:drop_if_empty ‑> by:string ‑> string ‑> (string * int * int) list

Split the given string along the given separator by. Should only be used with very small separators, otherwise use Containers_string.KMP.

val gen : ?⁠drop:drop_if_empty ‑> by:string ‑> string ‑> (string * int * int) gen
val seq : ?⁠drop:drop_if_empty ‑> by:string ‑> string ‑> (string * int * int) sequence
val klist : ?⁠drop:drop_if_empty ‑> by:string ‑> string ‑> (string * int * int) klist
Copying functions

Those split functions actually copy the substrings, which can be more convenient but less efficient in general.

val list_cpy : ?⁠drop:drop_if_empty ‑> by:string ‑> string ‑> string list
val gen_cpy : ?⁠drop:drop_if_empty ‑> by:string ‑> string ‑> string gen
val seq_cpy : ?⁠drop:drop_if_empty ‑> by:string ‑> string ‑> string sequence
val klist_cpy : ?⁠drop:drop_if_empty ‑> by:string ‑> string ‑> string klist
val left : by:string ‑> string ‑> (string * string) option

Split on the first occurrence of by from the leftmost part of the string.

val left_exn : by:string ‑> string ‑> string * string

Split on the first occurrence of by from the leftmost part of the string.

val right : by:string ‑> string ‑> (string * string) option

Split on the first occurrence of by from the rightmost part of the string.

val right_exn : by:string ‑> string ‑> string * string

Split on the first occurrence of by from the rightmost part of the string.