commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arun Thomas" <arun.tho...@paybytouch.com>
Subject RE: suggestion for new StringUtils.method
Date Tue, 11 Nov 2003 19:19:59 GMT
Actually, 

Given the existence of the bug, I'd suggest attaching the code to the bug, though posting
the code here usually works pretty well also.  Do add a note in the comments of the email/bug
regarding what else your posted code can do besides what's already described there.  If you
choose to take the email path, reference the bug report.  

Also, it would be great if you could provide JUnit tests - in general, new code won't become
part of the codebase until tests are available, so if you don't provide the tests, it may
take a little longer because a committer not only has to add the code, but has to write the
tests as well (unless some other kind volunteer takes the job of providing the tests).  

If you have access to the cvs repository, and a diff tool, try to add the code as a patch,
though, in the case of brand new code, this isn't quite as important.  I usually try to provide
two patches - one for the test cases, and one for the actual code base - this way, the test
case patch can be applied and shown to fail prior to addition of the code change.  

Check out the jakarta commons web site for more details on how to submit....

Cheers, 
-AMT

-----Original Message-----
From: Inger, Matthew [mailto:inger@Synygy.com] 
Sent: Tuesday, November 11, 2003 11:11 AM
To: 'Jakarta Commons Developers List'
Subject: RE: suggestion for new StringUtils.method


Being new to this list, how should i go about submitting 
this method?  Do i just post the code here?


-----Original Message-----
From: Arun Thomas [mailto:arun.thomas@paybytouch.com]
Sent: Tuesday, November 11, 2003 1:32 PM
To: Jakarta Commons Developers List
Subject: RE: suggestion for new StringUtils.method


Ooops....

Here's the bug entry:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22692

-AMT

-----Original Message-----
From: Arun Thomas 
Sent: Tuesday, November 11, 2003 10:31 AM
To: Jakarta Commons Developers List
Subject: RE: suggestion for new StringUtils.method


Take a look at the following bug entry currently in Bugzilla.... Your idea seems to be an
expansion of the desired functionality described by the "bug".  I would certainly add the
additional behaviour you propose (escape characters to prevent tokenization) to this bug.
 

It would be interesting, I think, if this functionality was provided as a StringTokenizer
replacement (subclass?) in line with Stephen's comment on the bug.  (This could be as simple
as a delegation to a StringUtils method, or a StringUtils convenience method could delegate
to the StringTokenizer
replacement.)  

Cheers, 
-AMT

-----Original Message-----
From: Inger, Matthew [mailto:inger@Synygy.com] 
Sent: Tuesday, November 11, 2003 10:03 AM
To: 'commons-dev@jakarta.apache.org'
Subject: suggestion for new StringUtils.method


The following method might be extremely useful for people:

String [] undelimit(String input, char separatorChar, char quoteChar);

This method splits a string according to a Delimiter seperated format
(CSV) for example.  It takes into account quoting, as well as allowing for empty tokens. 
So a string like the following:

a, , b, "c,d,e", "f""g""h",

would return the following tokens:

1- a
2- <blank>
3- b
4- c,d,e
5- f"g"h
6- <blank>

It happens to strip leading whitespace, but i could always make that optional.

It's an extremely efficient algorithm which runs through the underlying character array one
character at a time to build the tokens.

Any thoughts?

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message