Skip to content

Commit

Permalink
Add String.split_on_char to compatibility layer
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Sep 30, 2022
1 parent 7031716 commit b81fbc6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Compat.ml.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@
403: init (length s) (fun i -> Char.lowercase_ascii (unsafe_get s i))
403: let uppercase_ascii s =
403: init (length s) (fun i -> Char.uppercase_ascii (unsafe_get s i))
404:
404: let split_on_char sep s =
404: let r = ref [] in
404: let j = ref (length s) in
404: for i = length s - 1 downto 0 do
404: if unsafe_get s i = sep then begin
404: r := sub s (i + 1) (!j - i - 1) :: !r;
404: j := i
404: end
404: done;
404: sub s 0 !j :: !r
403:end

403:module Uchar = struct
Expand Down

0 comments on commit b81fbc6

Please sign in to comment.