X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Futils.mli;h=8edfaae7ed113e22ed2c775da491a1aa6691f43d;hb=800244e4c76abb5092b1f265a1186d76cfba6f06;hp=5fabcfb9b1d8e5fe6e114ed6ba17b68d999d1d12;hpb=6afdc65fcdb592dccb751849f65b1f482ef97cd6;p=goals.git diff --git a/src/utils.mli b/src/utils.mli index 5fabcfb..8edfaae 100644 --- a/src/utils.mli +++ b/src/utils.mli @@ -35,6 +35,21 @@ 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