Displaying 1 result from an estimated 1 matches for "is_spac".
Did you mean:
is_spam
2016 Jun 16
1
[PATCH] mllib: Add isspace, triml, trimr and trim functions.
.../mllib/common_utils.ml
index 64bf3d3..34e1285 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -49,6 +49,35 @@ module String = struct
and len = length str in
len >= sufflen && sub str (len - sufflen) sufflen = suffix
+ (* Note OCaml stdlib has an "is_space" function. *)
+ let isspace c =
+ c = ' '
+ (* || c = '\f' *) || c = '\n' || c = '\r' || c = '\t' (* || c = '\v' *)
+
+ let triml ?(test = isspace) str =
+ let i = ref 0 in
+ let n = ref (String.length str) in
+ wh...