commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chad Johnson" <>
Subject Re: Possible addition to StringUtils
Date Tue, 11 Dec 2001 17:38:02 GMT
----- Original Message -----
From: <>
To: "Jakarta Commons Developers List" <>
Sent: Tuesday, December 11, 2001 7:22 AM
Subject: Re: Possible addition to StringUtils

> So now we have:
> escape(String target, Map replacements)
> escape(String target, char value, char escapeWith)
> escape(String target, String value, String escapeWith)  (??)
> and unescape methods with the same arguments. Does this have good
> semantics?
> foo = escape(foo, 'n', '\\');
> foo = unescape(foo, 'n', '\\');
> Another question, what's the real difference between an escape method and
> a replace method? Is this just a replace method which takes a Map argument
> and replaces multiple things in one sweep? In which case, are the escape
> semantics necessary ( I think so), and is a replace(String, Map) method
> also therefore desired.
> Bay

I was thinking about that same thing on the way to work this morning.  For
unescape to work we need to limit the usage to(value, escapeWith).  Here's
an example problem if we allowed otherwise.

B escapes to \B
E escapes to \BB

What does the already escaped string "\BBBB" unescape to?

-Chad Johnon

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message