You're viewing version 1.2.0 of triml. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16
  • (triml s)
Removes whitespace from the left side of string.

1 Example top

  • (use 'clojure.string)
    (triml "        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:190 top

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

Comments top

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