commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chad Johnson" <ch...@netnet.net>
Subject Re: Possible addition to StringUtils
Date Tue, 11 Dec 2001 17:38:02 GMT
----- Original Message -----
From: <bayard@generationjava.com>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
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:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message