Module UtilsLib.Strings

module Strings: sig .. end

Additional functions to the String module

val init : int -> (int -> char) -> string
val fold_left : ('a -> char -> 'a) -> 'a -> string -> 'a
val nth : string -> int -> char option

get the nth char of a string in an exceptionless way

val nth_is : string -> int -> char -> bool

String.nth_is s ofs c returns true if the nth char is c

val set : string -> int -> char -> string

String.set s n c returns a copy of s where the nth's char of is set to c

val copy : string -> string
val create : int -> string
val fill : string -> int -> int -> char -> string

Strings.fill s n len c returns a copy of s where the range defined by n and n + len have been replaced by the char c (with len the length of the range to replace)

val char_rindex_from : string -> int -> char -> int option
val char_index_from : string -> int -> char -> int option
val char_index_all : string -> char -> int list
val char_split : char -> string -> string list

char_split s c splits the string s wherever the character c appears

val char_splitter : char -> string -> string list

same than char_split but also String.trims all strings and filters out all empty strings

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

cut the string at the first occurence of the char

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

cut the string at the last occurence of the char

val starts_with : string -> string -> bool

starts_with sub s returns true if s starts with sub

val ends_with : string -> string -> bool

ends_with sub s returns true if s ends with sub

val str_split : string -> string -> string list
val str_cut : string -> string -> (string * string) option
val string_index : string -> string -> int option
val string_rindex : string -> string -> int option
val string_index_from : string -> int -> string -> int option
val string_rindex_from : string -> int -> string -> int option
Deprecated

Functions that have been deprecated in OCaml 4.03.0

val uppercase : string -> string
val lowercase : string -> string
val capitalize : string -> string
val uncapitalize : string -> string