package containers

  1. Overview
  2. Docs
On This Page
  1. Copying functions
Legend:
Library
Module
Module type
Parameter
Class
Class type
val list_ : by:string -> string -> (string * int * int) list

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

  • returns

    a list of slices (s,index,length) that are separated by by. String.sub can then be used to actually extract a string from the slice.

  • raises Failure

    if by = ""

val gen : by:string -> string -> (string * int * int) gen
val seq : by:string -> string -> (string * int * int) sequence
val klist : 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 : by:string -> string -> string list
val gen_cpy : by:string -> string -> string gen
val seq_cpy : by:string -> string -> string sequence
val klist_cpy : 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

  • since 0.12
val left_exn : by:string -> string -> string * string

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

  • raises Not_found

    if by is not part of the string

  • since 0.16
val right : by:string -> string -> (string * string) option

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

  • since 0.12
val right_exn : by:string -> string -> string * string

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

  • raises Not_found

    if by is not part of the string

  • since 0.16
OCaml

Innovation. Community. Security.