Removes the last character of string, does nothing on a zero-length
string.
(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))))))
Comments top
No comments for chop. Log in to add a comment.