package opam-core

  1. Overview
  2. Docs

Collections

module Map : MAP with type key = string
module Set : SET with type elt = string
module SetSet : SET with type elt = Set.t

Set of string sets

module SetMap : MAP with type key = Set.t

Map of string sets

Checks

val starts_with : prefix:string -> string -> bool
val ends_with : suffix:string -> string -> bool
val contains_char : string -> char -> bool
val contains : sub:string -> string -> bool
val exact_match : Re.re -> string -> bool

Manipulation

val map : (char -> char) -> string -> string
val strip : string -> string
val strip_right : string -> string
val sub_at : int -> string -> string
val remove_prefix : prefix:string -> string -> string
val remove_suffix : suffix:string -> string -> string
Transformations
val cut_at : string -> char -> (string * string) option

Cut a string at the first occurrence of the given char

val rcut_at : string -> char -> (string * string) option

Same as cut_at, but starts from the right

val split : string -> char -> string list

Split a string at occurrences of a given characters. Empty strings are skipped.

val split_delim : string -> char -> string list

The same as split, but keep empty strings (leading, trailing or between contiguous delimiters)

val fold_left : ('a -> char -> 'a) -> 'a -> string -> 'a
OCaml

Innovation. Community. Security.