Added more String parsers (#106)
* Add Double/parseDouble * Add Boolean/parseBoolean
This commit is contained in:
parent
f7259c7498
commit
5695ee3a52
3 changed files with 34 additions and 0 deletions
15
src/babashka/impl/Boolean.clj
Normal file
15
src/babashka/impl/Boolean.clj
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(ns babashka.impl.Boolean
|
||||
{:no-doc true}
|
||||
(:refer-clojure :exclude [list]))
|
||||
|
||||
(set! *warn-on-reflection* true)
|
||||
|
||||
(defn parseBoolean [^String x]
|
||||
(Boolean/parseBoolean x))
|
||||
|
||||
(def boolean-bindings
|
||||
{'Boolean/parseBoolean parseBoolean})
|
||||
|
||||
(comment
|
||||
|
||||
)
|
||||
15
src/babashka/impl/Double.clj
Normal file
15
src/babashka/impl/Double.clj
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(ns babashka.impl.Double
|
||||
{:no-doc true}
|
||||
(:refer-clojure :exclude [list]))
|
||||
|
||||
(set! *warn-on-reflection* true)
|
||||
|
||||
(defn parseDouble [^String x]
|
||||
(Double/parseDouble x))
|
||||
|
||||
(def double-bindings
|
||||
{'Double/parseDouble parseDouble})
|
||||
|
||||
(comment
|
||||
|
||||
)
|
||||
|
|
@ -3,6 +3,8 @@
|
|||
(:require
|
||||
[babashka.impl.File :refer [file-bindings]]
|
||||
[babashka.impl.Integer :refer [integer-bindings]]
|
||||
[babashka.impl.Double :refer [double-bindings]]
|
||||
[babashka.impl.Boolean :refer [boolean-bindings]]
|
||||
[babashka.impl.Pattern :refer [pattern-bindings]]
|
||||
[babashka.impl.System :refer [system-bindings]]
|
||||
[babashka.impl.Thread :refer [thread-bindings]]
|
||||
|
|
@ -153,6 +155,8 @@ Everything after that is bound to *command-line-args*."))
|
|||
file-bindings
|
||||
thread-bindings
|
||||
integer-bindings
|
||||
double-bindings
|
||||
boolean-bindings
|
||||
exception-bindings
|
||||
pattern-bindings))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue