Finds the position of a character within a string, optionally
provide a starting index. Returns nil if none is found.
(defn char-position
"Finds the position of a character within a string, optionally
provide a starting index. Returns nil if none is found."
([c str] (char-position c str 0))
([#^Character c #^String str #^Integer start]
(let [idx (.indexOf str (int c) start)]
(when (not= -1 idx)
idx))))
Comments top
No comments for char-position. Log in to add a comment.