Java equivalent of C#'s verbatim strings with @

Simon Rigby picture Simon Rigby · Apr 20, 2010 · Viewed 27k times · Source

Quick question. Is there an equivalent of @ as applied to strings in Java:

For example I can do @"c:\afolder\afile" in C# and have it ignore the escape characters when processing instead of having to do "c:\\afolder\\aFile". Is there a Java equivalent?

hmmm: stackoverflow is escaping on me .. lol. The second example should read:

c:(double-backslash)afolder(double-backslash)aFile

Answer

Kent Boogaart picture Kent Boogaart · Apr 20, 2010

No. Escaping / externalizing the string is your only choice.