Add int-string? to check if a string is a number.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -8,6 +8,12 @@
|
||||
(if (re-matches #"\d+" str)
|
||||
true false))
|
||||
|
||||
(defn int-string?
|
||||
"Return true if the string is an signed integer."
|
||||
[str]
|
||||
(if (re-matches #"[+-]?\b\d+\b" str)
|
||||
true false))
|
||||
|
||||
(defn parse-unsigned-int
|
||||
"Return an integer if the argument is an integer."
|
||||
[str-or-int]
|
||||
|
||||
Reference in New Issue
Block a user