Is there a way to remove special characters(\n, \b, \t, \f, \r
) from a multi line string in Scala?
for a normal string
val someText = "some\nText\t"
someText.filter(_ >= ' ') // returns "someText"
How do I achieve the same, in multi line string
val multLineStr = """some\nText\t"""
someText.filter(_ >= ' ') // returns "some\nText\t"
I tried using regular expressions, couldn't remove the characters from the string.
val regex = new Regex("\\s")
regex.replaceAllIn(multLineStr, "") // returns "some\nText\t"