Returns the substring of s beginning at start inclusive, and ending
at end (defaults to length of string), exclusive.
user=> (subs "Clojure" 1) "lojure" user=> (subs "Clojure" 1 3) "lo" ;; String indexes have to be between 0 and (.length s) user=> (subs "Clojure" 1 20) java.lang.StringIndexOutOfBoundsException: String index out of range: 20 (NO_SOURCE_FILE:0)
(defn subs
"Returns the substring of s beginning at start inclusive, and ending
at end (defaults to length of string), exclusive."
{:added "1.0"
:static true}
(^String [^String s start] (. s (substring start)))
(^String [^String s start end] (. s (substring start end))))
Comments top
No comments for subs. Log in to add a comment.