Java – double quotation marks in Python, such as triple double quotation marks in Python

In Python, I can use:

test = """My "cute" string"""

Where double quotes are escaped Is there a way to simulate this in Java without using escape slashes?

Solution

No, there is no sensible way to do this in Java Judging from other answers, I would say that avoiding quotation is the least painful way

However, groovy (which can also run on a Java VM) can use single quotes:

`'some "String"'`

Or the so-called file here:

""" Everything here can be "quoted"
/"""

But Java does not have such a mechanism

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>