2023-08-27 01:57:02 +08:00
|
|
|
# stringCodepointSplitter
|
|
|
|
|
|
|
|
Split a string to a list of strings of a character by the unicode codepoint.
|
|
|
|
|
|
|
|
It requires module Uutf.
|
|
|
|
|
2023-08-27 12:29:31 +08:00
|
|
|
## Dependencies
|
2023-08-31 07:19:18 +08:00
|
|
|
- OCaml >= 4.06
|
2023-08-27 12:29:31 +08:00
|
|
|
- dune
|
|
|
|
- uutf
|
|
|
|
- fildlib
|
2023-08-27 04:39:10 +08:00
|
|
|
|
2023-08-27 12:29:31 +08:00
|
|
|
## Install
|
|
|
|
|
|
|
|
```
|
|
|
|
$ cd /path/to/stringCodepointSplitter
|
|
|
|
|
|
|
|
$ dune build
|
|
|
|
|
|
|
|
$ dune install
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
## Generate Docs
|
|
|
|
```
|
|
|
|
$ dune build @doc
|
|
|
|
```
|
|
|
|
|
|
|
|
Generated documentations will be in `/path/to/stringCodepointSplitter/_build/default/_doc` in
|
|
|
|
various formats, incl. html.
|
2023-08-27 04:39:10 +08:00
|
|
|
## Example
|
|
|
|
|
|
|
|
```OCaml
|
|
|
|
|
|
|
|
let example = "m̄知 who you're." (*don't know who you are*) in
|
|
|
|
|
|
|
|
List.map (fun x -> print_string (x ^ ", ")) (StringCodepointSplitter.split_string_by_unicode_codepoint example);;
|
|
|
|
|
|
|
|
(*it will output : "m, ̄, 知, , w, h, o, , y, o, u, ', r, e, ., "*)
|
|
|
|
```
|