Module UtilsLib.ImString

module ImString: sig .. end

Modified String module for immutable strings

type t 
val to_string : t -> string
val of_string : string -> t
val init : int -> (int -> char) -> t
val fold_left : ('a -> char -> 'a) -> 'a -> t -> 'a
val nth : t -> int -> char option

get the nth char of a string in an exceptionless way

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

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

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

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

val char_splitter : char -> t -> t list

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

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

cut the string at the first occurence of the char

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

cut the string at the last occurence of the char

val starts_with : t -> t -> bool

starts_with sub s returns true if s starts with sub

val ends_with : t -> t -> bool

ends_with sub s returns true if s ends with sub

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