multiline string/string literal without escape processing

Tom Ball tball at google.com
Sat Aug 20 16:51:04 PDT 2011


There's a great language you should considering using that has built-in
support for JS and JSON:  JavaScript.  Just because something can be written
in Java doesn't mean that it necessarily should, as real engineers write
code in the language most appropriate for the task before them (IMO).

Another option is to put the text you're currently laboriously escaping into
external resource files, and just read them in as needed.  The advantage to
keeping text in different files is that most editors and IDEs provide
syntax-specific formatting, which makes it easier to write and mades errors
easier to spot.  JSON?  Use a library to convert your data types instead of
doing it by hand, as the overhead is minimal.  Write unit tests for those
data classes and you have a much more robust solution that scales much
better than hand editing.

Tom

On Sat, Aug 20, 2011 at 12:16 PM, saeed yousefi <saeedtej at yahoo.com> wrote:

> I think Java as a mature language should now have some missed features and
> one of them is
> multiline string/string literal without escape processing . it can really
> reduce lots of developer's efforts in writing multiline Strings .
>
> As you know in situations like JSON  it's very hard and error-prone to
> write code without using this feature .
>
> as another example consider you 're writing JS code and you should do lots
> of literal escaping .
>
>
> so as a Java developer , can I hope to see this feature for JDK8 ?
>
> saeed
>
>



More information about the coin-dev mailing list