string_trim replaces String.trim for OCaml < 4.00

This commit is contained in:
John Whitington 2015-06-02 19:32:36 +01:00
parent d8cdc572bc
commit d81c17b6c5
2 changed files with 7 additions and 1 deletions

View File

@ -2889,8 +2889,14 @@ let dc = "http://purl.org/dc/elements/1.1/"
let rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
(* For OCaml < 4.00 *)
let string_trim s =
implode
(dropwhile
Pdf.is_whitespace (rev (dropwhile Pdf.is_whitespace (explode s))))
let combine_with_spaces strs =
String.trim
string_trim
(fold_left (fun x y -> x ^ (if x <> "" then ", " else "") ^ y) "" strs)
(* Collect all <li> elements inside a seq, bag, or alt. Combine with commas. If

Binary file not shown.