Missing feature(?): I want to count occurrences o...
# stdlib
v
Missing feature(?): I want to count occurrences of a substring in a string. Kotlin offers the
"string".count(predicate: (Char) -> Boolean): Int
method. But if my substring contains more than one character, this approach won't work. ApacheCommons offers a
countMatches(str: CharSequence, sub: CharSequence): Int
method. It would be great to have an equivalent functionality in the Kotlin stdlib. Please correct me if the functionality is already given but i overlooked it. (see http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#countMatches(java.lang.CharSequence,%20java.lang.CharSequence) )