fun main() {
val input = "ABC"
val output = "ABC,"
println(input.contains(output,false))
print(input in (output))
}
Output :
false
true
I just checked that, in
and contains
are using same method, but why giving difference results.
The Kotlin
contains
functionActually, you're checking if
input.contains(output)
, and"ABC"
does not contain"ABC,"
.The correct syntax is