Skip to main content  String literals and escapes  2 replies
[Last post] Joined: 2003-07-01 Points: 0  I would like to see
the C# feature of a prefix character to String literals which
tells Java not to expect escape sequences in the String.  This
would make file names simpler:  <br />   String filename =
"c:\\myproject\\mysubproject\\test.txt";<br />   // ...would
become...<br />   String filename =
@"c:\myproject\mysubproject\test.txt";<br />  As would regular
expressions:  <br />   String urlRegEx =
"(http)(://)(.*?)/(.*?)\\?(.*)"<br />   String urlRegEx =
@"(http)(://)(.*?)/(.*?)\?(.*)"<br />  Particularly when
filenames get long or regular expressions get more complicated
it would make them much easier to read.  Reply viewing options
Joined: 2004-03-15 Points: 0  +1 to this feature!. This is a way
to escape from the escape hell!  Joined: 2003-12-08 Points: 0
Is there any reason not to do this? When Java introduced regular
expression matching into the standard API with 1.4, it was a
huge help. This see