Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions jscomp/others/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ belt_SetString.cmj : belt_internalSetString.cmj belt_internalAVLset.cmj \
belt_Array.cmj belt_SetString.cmi
belt_MutableStack.cmj : belt_MutableStack.cmi
belt_MutableQueue.cmj : belt_Array.cmj belt_MutableQueue.cmi
belt_String.cmj : belt_String.cmi
node_child_process.cmj : node.cmj
js_math.cmj :
js_dict.cmj : js_array.cmj js_dict.cmi
Expand Down Expand Up @@ -145,6 +146,7 @@ belt_SetInt.cmi :
belt_SetString.cmi :
belt_MutableStack.cmi :
belt_MutableQueue.cmi :
belt_String.cmi :
js_dict.cmi :
js_cast.cmi :
dom.cmi : dom_storage.cmi
Expand Down
1 change: 1 addition & 0 deletions jscomp/others/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ SOURCE_LIST= node_path node_fs node_process dict node_module js_array js_string
belt_SetString\
belt_MutableStack\
belt_MutableQueue\
belt_String\
node_child_process \
js_math\
js_dict js_date js_global js_cast js_promise\
Expand Down
7 changes: 7 additions & 0 deletions jscomp/others/belt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,10 @@ module Result = Belt_Result
Utilities for set up debugging
*)
module Debug = Belt_Debug

(** {!Belt.String}

String utilities
*)
module String = Belt_String

12 changes: 12 additions & 0 deletions jscomp/others/belt_String.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
open String

let split_on_char sep s =
let r = ref [] in
let j = ref (length s) in
for i = length s - 1 downto 0 do
if unsafe_get s i = sep then begin
r := sub s (i + 1) (!j - i - 1) :: !r;
j := i
end
done;
sub s 0 !j :: !r
1 change: 1 addition & 0 deletions jscomp/others/belt_String.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
val split_on_char : char -> string -> string list