1.3.0 permalink Arrow_down_16x16
  • (subs s start)
  • (subs s start end)
Returns the substring of s beginning at start inclusive, and ending
at end (defaults to length of string), exclusive.

1 Example top

  • 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)
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:4387 top

(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))))
Vars in clojure.core/subs:
Used in 0 other vars

Comments top

No comments for subs. Log in to add a comment.