Skip to content

Commit

Permalink
add valid-number? validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrestivo committed May 7, 2012
1 parent 94fc41f commit dd71c36
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/noir/validation.clj
Expand Up @@ -53,7 +53,14 @@
(and (not (empty? v))
(> (Long/parseLong v) 0)))


(defn valid-number?
"Returns true if the string can be cast to a Long"
[v]
(try
(Long/parseLong v)
true
(catch Exception e
false)))

(declare ^:dynamic *errors*)

Expand Down

0 comments on commit dd71c36

Please sign in to comment.