This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn index-of-safe | |
"Return index of value (string or char) in s, optionally searching | |
forward from from-index. Return nil if value not found. | |
Works around https://bugs.openjdk.java.net/browse/JDK-8027640 | |
so the returned index is always greater equal to from-index. | |
This also works around JavaScript's similar behavior." | |
[s value from-index] | |
(if (< (count s) from-index) | |
nil | |
(clojure.string/index-of s value from-index))) |