You are viewing a development version of the library. Goto the latest version.

Module OASISUtils

module OASISUtils: sig .. end
Various utilities
Author(s): Sylvain Le Gall


module MapString: Map.S  with type key = String.t
val map_string_of_assoc : (string * 'a) list -> 'a MapString.t
Convert a string association list to a map.


module SetString: Set.S  with type elt = String.t
Set for String.
val set_string_add_list : SetString.t ->
SetString.elt list -> SetString.t
Add a string list to an existing Set.
val set_string_of_list : SetString.elt list -> SetString.t
Convert a string list to a Set.


module HashStringCsl: Hashtbl.S  with type key = String.t
Caseless string hashtable

Variable name

val varname_of_string : ?hyphen:char -> string -> string
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.
val varname_concat : ?hyphen:char -> string -> string -> string
varname_concat ~hyphen p s Concat variable name, removing hyphen at end of p and at beginning of s.
val is_varname : string -> bool
is_varname str Check that the string str is a valid varname. See OASISUtils.varname_of_string for definition.

Fail with Printf.sprintf

val failwithf : ('a, unit, string, 'b) Pervasives.format4 -> 'a
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


val compare_csl : string -> string -> int
Caseless compare function
val split_comma : string -> string list
Split a list using ',' as separator. Not exported
val split_newline : ?trim:bool -> string -> string list
Split a list using '\n' as separator. Not exported
val split_optional_parentheses : string -> string * string option
Split a string containing '(...)' optionally. Not exported
module POSIXShell: sig .. end