String.substringAfter(String) behaves incorrectly
markoteittinen opened this issue · 0 comments
markoteittinen commented
The following simple program shows incorrect result on Kotlin Playground:
val str = "This is not that long a string"
fun main() {
val part = str.substringAfter("is ").substringBefore(" long")
println("Full: $str")
println("Part: $part")
}
Obviously, it should display "not that", but instead it displays "is not that". It seems that substringAfter()
includes the delimiter string "is " parameter in its return value, but it should not.
When I run the same code on Android (i.e. JVM), the result is correctly "not that"