add v 0.0.1

This commit is contained in:
Tan, Kian-ting 2023-08-27 03:56:41 +08:00
parent 21519f3b9b
commit e2fc37e969
7 changed files with 74 additions and 29 deletions

27
dune-project Normal file
View file

@ -0,0 +1,27 @@
(lang dune 3.9)
(name stringCodepointSplitter)
(version 0.0.1)
(generate_opam_files true)
(source
(github yoxem/stringCodepointSplitter))
(authors "Tan Kian-ting <yoxem@kianting.info>")
(maintainers "Tan Kian-ting <yoxem@kianting.info>")
(bug_reports https://github.com/Yoxem/stringCodepointSplitter/issues)
(license MIT)
(documentation https://github.com/Yoxem/stringCodepointSplitter/tree/main/docs)
(package
(name stringCodepointSplitter)
(synopsis "Split a string to a list of strings of a character by the unicode codepoint")
(description "Split a string to a list of strings of a character by the unicode codepoint.
It requires module Uutf.")
(depends ocaml>=4.14 dune uutf)
(tags (string utf8)))
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project

4
lib/dune Normal file
View file

@ -0,0 +1,4 @@
(library
(name stringCodepointSplitter)
(public_name stringCodepointSplitter)
(libraries uutf findlib.dynload))

View file

@ -1,13 +1,13 @@
(*#use "topfind";;*)
open Stdlib
open Uutf
(**
The Module needs [Uutf] Module.
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]
@ -28,7 +28,7 @@ let split_string_by_unicode_codepoint str =
(*Split a Ocaml string [str] to a `str list` *)
let pred_codepoint = ref (-1) in
let segmented_unit_list = ref [] in
let iterator x y z =
let iterator x y _ =
let _ = if !pred_codepoint > -1 then
let current_codepoint = y in
let pred_char_len = current_codepoint - !pred_codepoint in
@ -48,7 +48,3 @@ let split_string_by_unicode_codepoint str =
else
!segmented_unit_list;;
List.map (fun x -> print_string (x ^ ", ")) (split_string_by_unicode_codepoint "m̄知 who you're.");;

View file

@ -0,0 +1,37 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.0.1"
synopsis:
"Split a string to a list of strings of a character by the unicode codepoint"
description: """
Split a string to a list of strings of a character by the unicode codepoint.
It requires module Uutf."""
maintainer: ["Tan Kian-ting <yoxem@kianting.info>"]
authors: ["Tan Kian-ting <yoxem@kianting.info>"]
license: "MIT"
tags: ["string" "utf8"]
homepage: "https://github.com/yoxem/stringCodepointSplitter"
doc: "https://github.com/Yoxem/stringCodepointSplitter/tree/main/docs"
bug-reports: "https://github.com/Yoxem/stringCodepointSplitter/issues"
depends: [
"ocaml>=4.14"
"dune" {>= "3.9"}
"uutf"
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/yoxem/stringCodepointSplitter.git"

View file

@ -1,21 +0,0 @@
opam-version: "2.0"
name: "stringCodepointSplitter"
version: "0.1"
synopsis: "Split a string to a list of strings of a character by the unicode codepoint"
description: """
Split a string to a list of strings of a character by the unicode codepoint.
It requires module Uutf.
"""
maintainer: "Tan Kian-ting <yoxem@kianting.info>"
authors: "Tan Kian-ting <yoxem@kianting.info>"
license: "MIT License"
homepage: "https://github.com/Yoxem/stringCodepointSplitter"
bug-reports: "https://github.com/Yoxem/stringCodepointSplitter/issues"
dev-repo: "https://github.com/Yoxem/stringCodepointSplitter"
depends: [ "ocaml" "uutf" ]
build: [
["./configure" "--prefix=%{prefix}%"]
[make]
]
install: [make "install"]

2
test/dune Normal file
View file

@ -0,0 +1,2 @@
(test
(name stringCodepointSplitter))

View file