Let's say you have a string literal with lots of quotes inside it. You could have avoided them all, but it is pain and hard to read.
In some languages, you can simply do this:
foo = '"Hello, World"';
In Java, however, '' used for char s, so you cannot use it for String in this way. Some languages have syntax to get around this. For example, in python you can do this:
"""A pretty "convenient" string"""
Does Java have something similar?
java string escaping
Matthew Pirocchi Jun 13 '10 at 22:45 2010-06-13 22:45
source share