We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f96e59b commit 8ec77c8Copy full SHA for 8ec77c8
src/valip/predicates.clj
@@ -3,6 +3,7 @@
3
form."
4
(:require [clojure.string :as string])
5
(:import
6
+ [java.net URL MalformedURLException]
7
java.util.Hashtable
8
javax.naming.NamingException
9
javax.naming.directory.InitialDirContext
@@ -48,6 +49,18 @@
48
49
(if-let [domain (second (re-matches #".*@(.*)" email))]
50
(boolean (dns-lookup domain "MX"))))
51
52
+(defn url?
53
+ "Returns true if the string is a valid URL."
54
+ [s]
55
+ (try
56
+ (URL. s) true
57
+ (catch MalformedURLException _ false)))
58
+
59
+(defn digits?
60
+ "Returns true if a string consists only of numerical digits."
61
62
+ (boolean (re-matches #"\d+" s)))
63
64
(defn integer-string?
65
"Returns true if the string represents an integer."
66
[s]
0 commit comments