commit
11fbe53e74
7 changed files with 23 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
||||||
(lang dune 3.9)
|
(lang dune 3.9)
|
||||||
|
(cram enable)
|
||||||
|
|
||||||
(name stringCodepointSplitter)
|
(name stringCodepointSplitter)
|
||||||
(version 0.0.1)
|
(version 0.0.1)
|
||||||
|
|
2
lib/dune
2
lib/dune
|
@ -1,4 +1,4 @@
|
||||||
(library
|
(library
|
||||||
(name stringCodepointSplitter)
|
(name stringCodepointSplitter)
|
||||||
(public_name stringCodepointSplitter)
|
(public_name stringCodepointSplitter)
|
||||||
(libraries uutf findlib.dynload))
|
(libraries uutf))
|
||||||
|
|
|
@ -13,9 +13,6 @@ Under MIT License
|
||||||
It only contains [split_string_by_unicode_codepoint], which splits an OCaml string [str] to a [string list]
|
It only contains [split_string_by_unicode_codepoint], which splits an OCaml string [str] to a [string list]
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let _ = Findlib.init ();;
|
|
||||||
Fl_dynload.load_packages ["uutf"];;
|
|
||||||
|
|
||||||
|
|
||||||
(** Split an OCaml string [str] to a [string list]
|
(** Split an OCaml string [str] to a [string list]
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
(test
|
(executable
|
||||||
(name stringCodepointSplitter))
|
(libraries stringCodepointSplitter)
|
||||||
|
(name stringCodepointSplitterTest))
|
||||||
|
|
||||||
|
(cram
|
||||||
|
(deps ./stringCodepointSplitterTest.exe))
|
||||||
|
|
11
test/stringCodepointSplitter.t
Normal file
11
test/stringCodepointSplitter.t
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
ASCII only
|
||||||
|
$ ./stringCodepointSplitterTest.exe abc
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
|
||||||
|
Still simple but not just ASCII
|
||||||
|
$ ./stringCodepointSplitterTest.exe «—»
|
||||||
|
«
|
||||||
|
—
|
||||||
|
»
|
4
test/stringCodepointSplitterTest.ml
Normal file
4
test/stringCodepointSplitterTest.ml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
let () =
|
||||||
|
Sys.argv.(1)
|
||||||
|
|> StringCodepointSplitter.split_string_by_unicode_codepoint
|
||||||
|
|> List.iter print_endline
|
Loading…
Reference in a new issue