Those are not escaped characters. Maybe that is the source of your trouble.
<
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6>
yeah, it was suspect...
unless the OP wants the editor to use a different set of escapes as to
allow multi-escaping or something, but '/' would be a poor choice for
this (would clash with other uses of the character).
I want to write/edit a long text/string I use in my source code, but
am annoyed every time, I want to make a change in it.
Externalize that string! Source code is no place for it.
When I put long strings in source, I break them up into multiple lines
for readability, e.g.,
public final static String LONGSTR =
"This is a long string. I like to keep listings narrow for readability.\n"
+"If you don't do that, you will have a hard time maintaining your code.\n"
+"I think maybe you didn't define your problem correctly.\n"
+"This way you don't have to futz around with silly mode switches.\n"
+"BTW, why do you insist on putting quotes around the word \"escaped\" "
+"every time you use it, much less \"plain text\"? "
+"They serve no useful purpose."
What I need is an editor, where I can edit a "plain text" with
linebreaks and quotes; simply converting into "escaped"-format
afterwards and back.
That's not really what you need. You need to format your long strings
for readability at a minimum, or ideally to externalize them.
NetBeans and Eclipse both highlight escaped characters in an optionally
different color, font and style from other text. Emacs does, too, IIRC.
Others probably do, too.
Does anyone know a usable editor. [sic]
Yes, I do. All the ones I just mentioned.
Searching the net several times, I couldnt find a usable one....
Use one of the ones I mentioned, then. They're all eminently usable.
one thing I have done before (mostly for C, less recommended for Java as
one can put text files in JAR's), was to write out a lot of text into a
text file, and then invoke a tool at build time to convert the text file
into a big string constant.
this is because otherwise, non-trivial cases involving files can be a
logistical mess in C-land, since there is no good way otherwise to
bundle files with programs (and the Windows "Resources" system is not
very good, and lacks a direct Linux analogue). so, it often ends up
nicer just to convert data into code and link it in directly.
but, yes, this is less advised for Java, since better probably is to
stuff the file into the JAR.
in my case, this was used mostly in a codegen for some occasional
slightly largish chunks of ASM (most other ASM was in small fragments
and emitted by printf-like statements).
in my case, my assembler allowed using '; ' for lumping multiple opcodes
per-line mostly as using this in a string constant was a little less
ugly than using a newline escape.
"push ebp; mov ebp, esp; sub esp, 128"
vs:
"push ebp\nmov ebp, esp\nsub esp, 128"
it can also help readability some with plain ASM as well, mostly by
increasing the visual code density (IMO, sometimes lumping multiple
statements on a line is a good thing WRT readability).
but, this little feature breaks compatibility with NASM and similar,
which always assume ';' to mean a comment (in my case, it is a comment
or a separator depending on context and surrounding white-space).