• (trimr s)
Removes whitespace from the right side of string.

1 Example top

  • (use 'clojure.string)
    (trimr "        my string         ")
    => "        my string"
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/string.clj:201 top

(defn ^String trimr
  "Removes whitespace from the right side of string."
  {:added "1.2"}
  [^CharSequence s]
  (loop [index (.length s)]
    (if (zero? index)
      ""
      (if (Character/isWhitespace (.charAt s (dec index)))
        (recur (dec index))
        (.. s (subSequence 0 index) toString)))))
Vars in clojure.string/trimr:
Used in 0 other vars

Comments top

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