Module Misc


module Misc: sig .. end
Misc convenient functions

val escape_quotes : string -> string
Replace the quotes in a string by """
val escape_entities : string -> string
Replace '<', '>' and '&' characters by their HTML code ("&lt;", "&gt;", "&amp;").
val apply_opt : ('a -> 'b) -> 'a option -> 'b option
val simplify_opt : 'a option option -> 'a option

String functions


val break_string : char -> string -> string list
Break a string into words. In first approximation words are characters strings that are delimited by sep characters.

More precisely, a word is a range of consecutive characters that respectively begins and ends by the separator or respectively by the beginning or the end of the string.

   break_string '|' "a|b" = ["a"; "b"]
   break_string '|' "a|b|c" = ["a"; "b"; "c"]
   break_string '|' "a|" = ["a"; ""]
   break_string '|' "|a" = [""; "a"]
   break_string '|' "|" = [""; ""]
   break_string '|' "a" = ["a"]
   

val opt_of_string : string -> string option
val string_of_opt : string option -> string
val no_blanks : string -> string
no_blanks s return the given string without any blank characters, i.e. '\n' '\r' ' ' '\t'.