While using IntelliJ Idea to code Scala I’ve noticed it to use to offer to enclose a string literal in a second pair of double quotes. «Convert to “””string”””» – it says. If I agree – it just adds a 2 more double quote marks before and 2 more after the string, having my string to look like
val myString = """my string value"""
How does this make any sense? Do triple double quotes mean something special in Scala?
With IntelliJ smart String, there should be only two cases.
So when you see this:
you should end up with
""". If not, this should be reported as a bug in the youtrack Scala project.But if there were triple double quotes, then IntelliJ correctly transformed your simple String into a multi-line String literal, which, as illustrated by langref, allows you to define:
into
Rosetta code mentions the behavior has changed between Scala 2.7 and 2.8:
Scala 2.7:
Scala 2.8