object FirstfInstanceIndex {
def main(args: Array[String]): Unit = {
val s = "Scala Programming"
val charToFind = 'm'
val index = s.indexOf(charToFind)
if (index != -1) {
println(s"The first occurrence of '$charToFind' is at index $index")
} else {
println(s"'$charToFind' not found in the string")
}
}
}
/*
run:
The first occurrence of 'm' is at index 12
*/