commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Chaffee / Purple Technology <>
Subject Re: [lang] Summarising Purple Was: [lang] Adding Purple to StringUtils
Date Sun, 09 Mar 2003 20:08:55 GMT
* abbreviate
OK!  How about I add this one myself?  I'm a Tomcat committer; whom do
I ask to add me to the karma list for commons?  (I think I heard that
Tomcat committers don't need a confirmation vote.)

* integrate truncateNicely and abbreviate

This I'd have to do research on; probably should wait until
abbreviate() is done.

* differentAt, differentText

I like these names.  Another suggestion is to use "difference" since
that describes the return value (and "different" implies it's
returning a boolean, like "is different" vs. "get the difference").

So can I get a +1 on:
	public String difference(String s1, String s2)
	public int differenceAt(String s1, String s2)

* Change chomp to match perl

I can do this too.

* Rename current chomp

I've been getting in the habit of restricting the use of "get" in
method names (properties only).  So I prefer a verb like "bisect" or
"divide" rather than "getAfterFirst" and such.  

I think "bisect" is good since it explicitly means "two parts" rather
than "split" which returns many parts.

* Change getPrechomp [aka getAfterFirst or bisectAfter] to not return
the separator.

That sounds fine; how do we handle deprecation warnings for this and
for chomp?  (In case people rely on the old behavior.)

* escapeHtml, unescapeHtml 
* escapeJava, escapeJavaScript
* future: escapeSql, escapeXml, unescape*

Henri suggested to make to hold all these.  I
like that a lot.  Any more +1s?

As for deprecation, the only method that would need to be deprecated
is StringUtils.escape.  Since Java escaping is the natural thing you'd
expect StringUtils to do, it makes sense to leave it in there as
StringUtils.escape.  So I propose leaving that as it is, and instead
just making it call StringEscapeUtils.escapeJava.

* uncurlQuotes

There was no vote on this.  It's not escaping, but converting, so I
think it belongs in the base StringUtils.  Any objections?

* toUnderscoreName, toCamelCaseName

This is not escaping, so it doesn't belong in StringEscapeUtils.  I'd
be happy to put them in StringUtils...

... especially since I just realized that these two methods, in
combination with upperCase and lowerCase and and replace(s, "_", " ")
and uncapitalise and capitaliseAllWords, can be used to convert
between all of

	yo mama
	Yo Mama

The only question now is how many convenience methods we want to
clutter the API with.

Alex Chaffee                     
Purple Technology - Code and Consulting
jGuru - Java News and FAQs       
Gamelan - the Original Java site 
Stinky - Art and Angst           

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

View raw message