package xtmpl

  1. Overview
  2. Docs

Misc functions.

val string_of_file : string -> string
val split_string : ?keep_empty:bool -> string -> char list -> string list
val strip_string : string -> string
val file_of_string : file:string -> string -> unit
val map_string : (Buffer.t -> Sedlexing.lexbuf -> 'a) -> string -> string

map_string lexer string creates an empty buffer with same initial length as the string, and a lexbuf from string. It passes them to the lexer, then returns the contents of the buffer. The lexer is supposed to fill the buffer. If the Sedlexing.Malformed exception is raised, then the Failure exception is raised with a message.

val escape : ?quotes:bool -> string -> string

Replace the following characters: < by &lt;, > by &gt;, & by &amp;. Also replace simple and double quotes by &apos; and &quot; if quotes = true (which is false by default).

val string_of_pp : (Format.formatter -> 'a -> unit) -> 'a -> string

string_of_pp pp x uses pretty-printing function pp on x to print in a buffer and return a string.

OCaml

Innovation. Community. Security.