• (chop s)
Removes the last character of string, does nothing on a zero-length
string.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/string.clj:236 top

(defn ^String chop
  "Removes the last character of string, does nothing on a zero-length
  string."
  [^String s]
  (let [size (count s)]
    (if (zero? size)
      s
      (subs s 0 (dec (count s))))))
Vars in clojure.contrib.string/chop: count dec defn let subs zero?
Used in 0 other vars

Comments top

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