You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

16 lines
351 B

module S = import "lua/string.ml"
open import "prelude.ml"
let split_on ch str =
let len = S.length str
let rec go i acc acc' =
if i > len then
reverse (acc :: acc')
else
let this = S.substring str i i
if this == ch then
go (i + 1) "" (acc :: acc')
else
go (i + 1) (acc ^ this) acc'
go 1 "" []