// Case-insensitive check without a loop
fun charExistsIgnoreCase(s: String, target: Char): Boolean {
// Convert both to lowercase and use contains()
return s.lowercase().contains(target.lowercase())
}
fun main() {
// Define the string we want to search in
val s = "KotlinLanguage"
// Perform the case-insensitive check
val exists = charExistsIgnoreCase(s, 'k')
// Print the raw boolean result
println(exists)
// Conditional check
if (exists) {
println("exists")
} else {
println("not exists")
}
}
/*
run:
true
exists
*/