7

In C#, you can use verbatim string literals so that you don't have to include '+' sign to concatenate strings on multiple lines. For example:

var fooStr = @"This is a foo string.
              It will have a corresponding bar sibling string";

In Java, the same code will be written as:

String fooStr = "This is a foo string." +
                "It will have a corresponding bar sibling string";

I know there is no equivalent of verbatim strings in Java and you have to escape the strings yourself. But is there an equivalent of this specific functionality? Or is there a library which helps achieve this?

chaudharyp
  • 3,394
  • 3
  • 26
  • 42

0 Answers0