Strings In Depth12 / 19
Up next

substring and slice

@main def main(): Unit =
  val s = "hello world"
  // substring(start, end) is end-exclusive
  println(s.substring(0, 5))
  // slice reads like it does on any sequence
  println(s.slice(6, 11))
What you're solving

extract a sub-range of text