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 123 views
1 answer 141 views
1 answer 142 views
2 answers 162 views
1 answer 124 views
1 answer 123 views
1 answer 2,226 views
...