Read References field; referred by listing; test & tidy documentation

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@39 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
fox
2022-12-12 22:52:55 +00:00
parent e6452a861d
commit 1547dc4d27
9 changed files with 108 additions and 38 deletions

View File

@@ -1,7 +1,12 @@
include Set.Make(String)
let list_of_csv x = Str.(split (regexp " *, *")) (String.trim x)
let of_string x = of_list (list_of_csv x)
let list_of_ssv x = Str.(split (regexp " +")) (String.trim x)
let of_string ?(separator=list_of_csv) x = of_list (separator x)
let of_csv_string x = of_string ~separator:list_of_csv x
let of_ssv_string x = of_string ~separator:list_of_ssv x
let to_string ?(pre="") ?(sep=", ") s =
let j a x = match a, x with "", _ -> x | _, "" -> a | _ -> a ^ sep ^ x in
fold (fun x acc -> j acc x) s pre