summaryrefslogtreecommitdiff
path: root/lib/number.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/number.fnl
init
Diffstat (limited to 'lib/number.fnl')
-rw-r--r--lib/number.fnl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/number.fnl b/lib/number.fnl
new file mode 100644
index 0000000..61d8cc4
--- /dev/null
+++ b/lib/number.fnl
@@ -0,0 +1,6 @@
+(fn string->number [str]
+ (if str
+ (tonumber (pick-values 1 (str:gsub "[^0-9.]" "")))
+ nil))
+
+{: string->number}