Various utilities
varname_of_string ~hyphen:c s Transform a string s into a variable name,
following this convention: no digit at the beginning, lowercase, only a-z
and 0-9 chars. Whenever there is a problem, use an hyphen.
varname_concat ~hyphen p s Concat variable name, removing hyphen at end
of p and at beginning of s.
is_varname str Check that the string str is a valid varname. See
varname_of_string for definition.
This function raise the Failure exception just as failwith
except that one specify the string raised through a format string.
Example: failwithf "Cannot do %s because of %d" str i
Caseless compare function
may f (Some x) calls f x or do nothing.
split s: the string s is interpreted as command line
arguments and splitted into its components (un-escaped). For
example split "a \"b c\" d" = ["a"; "b c"; "d"]. Note that
split "" = []. It is possible that substitutions such as "$a"
(resp. "$(a b)") may be transformed into "${a}" (resp. "${a b}").
escape s quote s if needed to protect spaces, '"' and '\''
so it reads as a single argument in a POSIX shell command, the
content of which is identical to s (interpreted with OCaml
conventions). If quoted, the returned string will start and end
with '"'. The original string s is returned if no quoting is
necessary.
unescape s returns a string s' removing all backslashes
preceding a char.