summaryrefslogtreecommitdiff
path: root/lib/number.fnl
diff options
context:
space:
mode:
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}