commit
						11fbe53e74
					
				
					 7 changed files with 23 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
(lang dune 3.9)
 | 
			
		||||
(cram enable)
 | 
			
		||||
 | 
			
		||||
(name stringCodepointSplitter)
 | 
			
		||||
(version 0.0.1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								lib/dune
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								lib/dune
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
(library
 | 
			
		||||
 (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] 
 | 
			
		||||
*)
 | 
			
		||||
 | 
			
		||||
let _ = Findlib.init ();;
 | 
			
		||||
Fl_dynload.load_packages ["uutf"];;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
(** Split an OCaml string [str] to a [string list] 
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,2 +1,6 @@
 | 
			
		|||
(test
 | 
			
		||||
 (name stringCodepointSplitter))
 | 
			
		||||
(executable
 | 
			
		||||
 (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