Strings In Depth7 / 19
Up next

indexOf

@main def main(): Unit =
  val s = "hello"
  // indexOf returns the position, or -1 if absent
  println(s.indexOf('l'))
  println(s.indexOf("xyz"))
What you're solving

position of a char or substring