This has been asked several times for several languages but I can\'t get it to work. I have a string like this
String str = \"This is a string.\\nThis is a l
It works for me. The Java code works exactly as you wrote it. In the tester, the input string should be:
This is a string. This is a long string.
...with a real linefeed. You can't use:
This is a string.\nThis is a long string.
...because it treats \n as the literal sequence backslash 'n'.
\n