mirror of
https://github.com/richardharrington/robotwar.git
synced 2024-06-11 06:29:31 +00:00
refactored re-find to re-matches for whole words
This commit is contained in:
parent
90152aa425
commit
b0c4f798ec
|
@ -52,13 +52,13 @@
|
|||
(defn str->int
|
||||
"Like Integer/parseInt, but returns nil on failure"
|
||||
[s]
|
||||
(and (re-find #"^-?\d+$" s)
|
||||
(and (re-matches #"-?\d+" s)
|
||||
(Integer/parseInt s)))
|
||||
|
||||
(defn valid-word
|
||||
"Capital letters and numbers, starting with a capital letter"
|
||||
[s]
|
||||
(re-find #"^[A-Z]+\d*$" s))
|
||||
(re-matches #"[A-Z]+\d*" s))
|
||||
|
||||
(defn ignoring-args-thunk [x] (fn [& _] x))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user