package ocplib_stuff

  1. Overview
  2. Docs

Module EzStringSource

Extension of the stdlib String module

Sourceval for_all : (char -> bool) -> string -> bool

for_all fn s tests whether every characters of s verify fn

Sourceval exists : (char -> bool) -> string -> bool

exists fn s tests whether at least a character of s verifies fn

Sourceval before : string -> int -> string

before s pos returns the substring before pos (the character at position pos is not included)

Sourceval after : string -> int -> string

after s pos returns the substring after pos (the character at position pos is not included)

Sourceval starts_with : string -> prefix:string -> bool

starts_with s ~prefix checks whether s starts with prefix

Sourceval ends_with : string -> suffix:string -> bool

ends_with s ~suffix checks whether s ends with suffix

Sourceval cut : string -> int -> string * string

cut pos s returns the substrings of s before and after the position pos. The character at position pos is not included

Sourceval cut_at : string -> char -> string * string

cut_at c s returns the substring of s before and after the position first occurence of character c.

Sourceval rcut_at : string -> char -> string * string

rcut_at c s returns the substring of s before and after the position last occurence of character c.

Sourceval split : string -> char -> string list

split s c splits the string s on characters c, starting from the left. Invariant: String.concat (String.make 1 c) (split s c) = s

Sourceval split_simplify : string -> char -> string list

split s c splits the string s on characters c, starting from the left, removing empty sub strings.

Sourceval chop_prefix : string -> prefix:string -> string option
Sourceval chop_suffix : string -> suffix:string -> string option
OCaml

Innovation. Community. Security.