String escaping in Java

Hi there,I've been programming in Java for 5 years now, and there is one feature which will make my life alot easier.I'm talking about string escaping (a la c#'s @"c:\Docs\Source\a.txt", or python's single quoted strings).What do you think about it?
[281 byte] By [gilhoffera] at [2007-10-2 9:13:02]
# 1
That would be kind of handy, I guess, but if you have a lot of Strings that need escaping hard coded into your application then it is probably because you are designing badly anyway, right?Drake
Drake_Duna at 2007-7-16 23:20:05 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 2
And to add to that, assuming that a literal backslash represents a file separator is DEFINITELY bad design.Drake
Drake_Duna at 2007-7-16 23:20:05 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 3

> And to add to that, assuming that a literal backslash

> represents a file separator is DEFINITELY bad

> design.

>

> Drake

It was just an example...

Escaping is as useful when using XPaths, Regular expressions, etc...

Don't pick to the small details :) (And picking to the path seperator (I'm wide aware of the static members of class File) is really nto relevant)

I agree that most strings should be externalized (it's not a matter of design, just of good programming), but still, some strings will always stay hardcoded.

(js escaping your '<' in xmls is better?) - mostly when experimenting and writing some 'scratchbook' code.

The facility for escaping strings in C# and in Python is very useful. Moreover, adding this string escaping mechanism will be backward compatible.

Any other opinions?

Thanks :)

gilhoffera at 2007-7-16 23:20:05 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 4

> Hi there,

> I've been programming in Java for 5 years now, and

> there is one feature which will make my life alot

> easier.

> I'm talking about string escaping (a la c#'s

> @"c:\Docs\Source\a.txt", or python's single quoted

> strings).

>

> What do you think about it?

It could be handy, but personally I don't think it's a problem that needs fixing or even a situation that needs improving.

My personal opinion is there is not sufficient gain in it worth to introduce a new syntax element. But it's of course up to the language designers to make that judgement.

Lokoa at 2007-7-16 23:20:05 > top of Java-index,Other Topics,Java Community Process (JCP) Program...