mirror of
https://github.com/richardharrington/robotwar.git
synced 2026-04-21 15:16:29 +00:00
refactored re-find to re-matches for whole words
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user