scala reverse string

To reverse a string in Scala, you can use the reverse method provided by the String class. Here's an example:

val str = "Hello, World!"
val reversed = str.reverse

This code will output the reversed string:

!dlroW ,olleH

The reverse method reverses the characters in a string and returns a new string with the reversed order.