package xtmpl

  1. Overview
  2. Docs

Module Xtmpl.MiscSource

Misc functions.

Sourceval string_of_file : string -> string
Sourceval split_string : ?keep_empty:bool -> string -> char list -> string list
Sourceval strip_string : string -> string
Sourceval file_of_string : file:string -> string -> unit
Sourceval 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.

Sourceval 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).

Sourceval 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.