summaryrefslogtreecommitdiff
path: root/lib/string.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string.fnl')
-rw-r--r--lib/string.fnl11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/string.fnl b/lib/string.fnl
new file mode 100644
index 0000000..466dac9
--- /dev/null
+++ b/lib/string.fnl
@@ -0,0 +1,11 @@
+(fn split [string]
+ (accumulate [res [] v _
+ (string:gmatch "%S+")]
+ (do
+ (table.insert res v)
+ res)))
+
+(fn ends-with [string end]
+ (= (string.sub string (- (# end))) end))
+
+{: split : ends-with}