feat(std): add string splitter
This commit is contained in:
parent
818b38bef7
commit
867f3434f3
@ -20,5 +20,13 @@
|
||||
(or (= nil s)
|
||||
(= "" s)))
|
||||
|
||||
(fn std.s-split [s sep]
|
||||
(var t {})
|
||||
(let [sep (or sep "%s")
|
||||
re (.. "([^" sep "]+)")]
|
||||
(each [str (string.gmatch s re)]
|
||||
(table.insert t str))
|
||||
t))
|
||||
|
||||
std
|
||||
;;; std.fnl ends here
|
||||
|
Loading…
Reference in New Issue
Block a user