summaryrefslogtreecommitdiff
path: root/lib/string.fnl
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-09-26 17:46:38 +0600
committerunwox <me@unwox.com>2024-09-26 17:46:38 +0600
commit9b82db238f9e2e02a76f95c793f8d6ef2387ecfd (patch)
treecdb2a16d01f09553b560ab1034d53392d07bae42 /lib/string.fnl
init
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}