(index-of s value)
(index-of s value from-index)
Return index of value (string or char) in s, optionally searching
forward from from-index. Return nil if value not found.
Source
(defn index-of
"Return index of value (string or char) in s, optionally searching
forward from from-index. Return nil if value not found."
{:added "1.8"}
([^CharSequence s value]
(let [result ^long
(if (instance? Character value)
(.indexOf (.toString s) ^int (.charValue ^Character value))
(.indexOf (.toString s) ^String value))]
(if (= result -1)
nil
result)))
([^CharSequence s value ^long from-index]
(let [result ^long
(if (instance? Character value)
(.indexOf (.toString s) ^int (.charValue ^Character value) (unchecked-int from-index))
(.indexOf (.toString s) ^String value (unchecked-int from-index)))]
(if (= result -1)
nil
result))))