Kotlin program to demonstrate the example of containsMatchIn() function
// Example of containsMatchIn() function
fun main()
{
// Regex to match any string starting with 'i'
val pattern = Regex("^i")
println(pattern.containsMatchIn("includehelp"))
println(pattern.containsMatchIn("Incognito"))
}
Output:
true
false
Explanation:
The first string ("includehelp") starts with "i" and the second string ("Incognito") starts with "I". Thus, the output is true and false.
Kotlin program to demonstrate the example of containsMatchIn() function
Output:
Explanation:
The first string ("includehelp") starts with "i" and the second string ("Incognito") starts with "I". Thus, the output is true and false.
need an explanation for this answer? contact us directly to get an explanation for this answer