How to replace comma (,) with semicolon (;) in a string with Scala

1 Answer

0 votes
object Main extends App {
  var str = "scala,java,c,c++,c#,rust"

  // Replace commas with semicolons
  str = str.replace(",", ";")

  println(str)
}



/*
run:

scala;java;c;c++;c#;rust

*/

 



answered Dec 3, 2024 by avibootz

Related questions

1 answer 259 views
1 answer 283 views
1 answer 278 views
2 answers 350 views
1 answer 273 views
1 answer 264 views
1 answer 2,396 views
...