1.2.0 permalink Arrow_down_16x16
  • (take s n)
Take first n characters from s, up to the length of s.

Note the argument order is the opposite of clojure.core/take; this
is to keep the string as the first argument for use with ->

1 Example top

  • (take 23 [1 2 4 5 6])
    (1 2 4 5 6)
    
    (take 3 [1 2 4 5 6])
    (1 2 4)
    
    (take -1 [1 2 4 5 6])
    ()
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/str_utils2.clj:110 top

(defn ^String take
  "Take first n characters from s, up to the length of s.

  Note the argument order is the opposite of clojure.core/take; this
  is to keep the string as the first argument for use with ->"
  [^String s n]
  (if (< (count s) n)
    s
    (.substring s 0 n)))
Vars in clojure.contrib.str-utils2/take: < count defn take
Used in 0 other vars

Comments top

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