Coming from Perl, I sure am missing the \"here-document\" means of creating a multi-line string in source code:
$string = <<\"EOF\" # create a three-l
Since Java does not (yet) native support multi-line strings, the only way for now is to hack around it using one of the aforementioned techniques. I built the following Python script using some of the tricks mentioned above:
import sys
import string
import os
print 'new String('
for line in sys.stdin:
one = string.replace(line, '"', '\\"').rstrip(os.linesep)
print ' + "' + one + ' "'
print ')'
Put that in a file named javastringify.py and your string in a file mystring.txt and run it as follows:
cat mystring.txt | python javastringify.py
You can then copy the output and paste it into your editor.
Modify this as needed to handle any special cases but this works for my needs. Hope this helps!