X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Futils.mli;h=8edfaae7ed113e22ed2c775da491a1aa6691f43d;hb=881b2e9b7bad0da8f44418e9e6558710db5ce690;hp=e3981cd6951370e9812d90ae4d62f18207560c32;hpb=315ceff80b09b76959a067fa2f3288f22d2e55da;p=goals.git diff --git a/src/utils.mli b/src/utils.mli index e3981cd..8edfaae 100644 --- a/src/utils.mli +++ b/src/utils.mli @@ -35,8 +35,26 @@ val string_find : string -> string -> int (** [string_find str sub] finds the index of [sub] in [str]. If not found, returns -1. *) +val split : string -> string -> string * string +(** [split sep str] splits [str] at the first occurrence of the + separator [sep], returning the part before and the part after. + If separator is not found, return the whole string and an + empty string. *) + +val nsplit : ?max:int -> string -> string -> string list +(** [nsplit ?max sep str] splits [str] into multiple strings at each + separator [sep]. + + As with the Perl split function, you can give an optional + [?max] parameter to limit the number of strings returned. The + final element of the list will contain the remainder of the + input string. *) + val isspace : char -> bool val triml : ?test:(char -> bool) -> string -> string val trimr : ?test:(char -> bool) -> string -> string val trim : ?test:(char -> bool) -> string -> string (** Trim strings at left, right or both. *) + +val absolute_path : string -> string +(** Convert any path into an absolute path. *)