(def my-java-class String)
#'user/my-java-class
(instance? Object String)
true
(def String 1)
#'user/String
(isa? "hi" String)
false
(def String 42)
#'user/String
(let [string "hello world" len 5] (apply str (take (- (count string) len) string)))
"hello "
(println "Clojurebot: I'm sorry, I didn't mean it. Friends?")
nil
"Clojurebot: I'm sorry, I didn't mean it. Friends?\n"
(defn #^{:tag String} shout [#^{:tag String} s] (.toUpperCase s))
#'user/shout
(instance? String "hi")
true
(= java.lang.String String)
true
(new String "Hello")
"Hello"
(instance? String "x")
true
(new String "test")
"test"
(instance? String "AeroNotix")
true
(derive String ::foo)
nil
(derive String :foo)
nil
(instance? String "")
true
(isa? String ::blah)
false
(isa? "123" String)
false
(isa? "string" String)
false
(instance? String "123")
true
(def s String)
#'user/s
(class (new String))
java.lang.String
(keyword "pretty much any string can be a keyword")
:pretty
(defn only-integer? [string] (empty? (map integer? (.parseInt string))))
#'user/only-integer?
(instance? String "string")
true
(instance? String Object)
false
(isa? [String] [Object])
true
(instance? String nil)
false
(new String "")
""
(derive String ::blah)
nil
(defn #^{:tag String} shout [#^{:tag String} s] s)
#'user/shout
(def tmplt "Here is a silly string with a number ~(int x)")
#'user/tmplt
(= (new String) (String.))
true
(def m {:name String})
#'user/m
(isa? String (String. "foo"))
false
(= (class "f") String)
true
(macroexpand '(.getMethods String))
(.getMethods String)
(-> String (isa? Object))
true
(instance? String "hello world")
true
(new String (.getBytes "foo"))
"foo"
(macroexpand '(.getName String))
(.getName String)
(isa? (type "hi") String)
true
(isa? String (class "foo"))
true
(= '(String) [java.lang.String])
false
(vec (map #(with-meta % {:tag String}) '[s a b]))
[s a b]
(clojure.string/split "this string \"has a quote\" in it" #"\"[^\"]*\"")
["this string " " in it"]
(println (str (char 001) "PRIVMSG #clojure :Hi there, I'm clojurebot."))
nil
"PRIVMSG #clojure :Hi there, I'm clojurebot.\n"
((fn [string] (apply str (re-seq #"[A-Z]" string))) "HeLlO, WoRlD!")
"HLOWRD"
(defn only-digits? [string] (if (re-matches #"[A-Z]" (clojure.string/replace string " " "")) true))
#'user/only-digits?