How to get a substring between two indexes of a string in Scala

1 Answer

0 votes
object Main extends App {
  val s = "c++ python scala java"
  val start = 2
  val end = 6

  println(s.substring(start, end))
}



/*
run:

+ py

*/

 



answered Sep 30, 2024 by avibootz

Related questions

...