Module Ben.Core

Utility functions and modules.

This module contains handy functions (or modules) not specific to Ben.

module StringSet : sig ... end
module StringMap : sig ... end
module IntMap : sig ... end
val with_in_channel : Stdlib.in_channel -> (Stdlib.in_channel -> 'a) -> 'a

Run the function on the in_channel, taking care of exceptions.

val with_in_file : string -> (Stdlib.in_channel -> 'a) -> 'a

Run the function on the given file, taking care of exceptions.

val with_out_file : string -> (Stdlib.out_channel -> 'a) -> 'a

Run the function on the given file, taking care of exceptions .

val escape_for_shell : string -> string

Quote a string for use with shell. For example, "a" is quoted into "'a'".

val get_rfc2822_date : unit -> string

Get the current date in RFC-2822 format.

val list_rev_mapi : (int -> 'a -> 'b) -> 'a list -> 'b list

Same as List.rev_map, but calls the function with the index of the current element.

val uniq : 'a list -> 'a list

Remove duplicates in a list.

val simple_split : char -> string -> string list

simple_split sep s splits s using sep as delimiter.

val capitalize : ?sep:char -> string -> string

capitalize ?sep s capitalizes a field name.

val starts_with : string -> string -> bool

starts_with s prefix returns true iff s starts with prefix.

val ends_with : string -> string -> bool

ends_with s suffix returns true iff s ends with suffix.