How to trim prefix and suffix characters from a string in Scala

1 Answer

0 votes
object Main extends App {
  var str = "'java scala c c++'"
  
  str = str.stripPrefix("'").stripSuffix("'")

  println(str)
}


   
/*
           
run:
     
java scala c c++
       
*/

 



answered Sep 11, 2024 by avibootz
...