You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Arun Thomas <ar...@paybytouch.com> on 2003/11/12 01:28:52 UTC
SUBMITING new StringUtils.method
Goto http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22692
Attach your source and test files.
-AMT
P.S.
// defaults to true
public boolean isIgnoreLeadingWhitespace();
public void setIgnoreLeadingWhitespace(boolean ignoreLeadingWhitespace);
// defaults to true
public boolean isIgnoreTrailingWhitespace();
public void setIgnoreTrailingWhitespace(boolean ignoreTrailingWhitespace);
// defaults to false
public boolean isTreatEmptyAsNull();
public void setTreatEmptyAsNull(boolean treatEmptyAsNull);
The "is" methods read strangely to me. I think they may read better for both the "is" and "set" methods if the signatures were as follows:
// defaults to true
public boolean isIgnoringLeadingWhitespace();
public void setIgnoringLeadingWhitespace(boolean ignoreLeadingWhitespace);
// defaults to true
public boolean isIgnoringTrailingWhitespace();
public void setIgnoringTrailingWhitespace(boolean ignoreTrailingWhitespace);
// defaults to false
public boolean isTreatingEmptyAsNull();
public void setTreatingEmptyAsNull(boolean treatEmptyAsNull);
-----Original Message-----
From: Inger, Matthew [mailto:inger@Synygy.com]
Sent: Tuesday, November 11, 2003 4:08 PM
To: 'Jakarta Commons Developers List'
Subject: RE: suggestion for new StringUtils.method
I've come up with the following class for this.
(I also have a test class which tests a few of the
simple cases). Token parsing is done semi-lazily,
in that when the first token is requested (or the
token count), the whole thing is parsed. And the
reset forgets about the tokens, so you can change
parameters, and re-parse.
public class DelimitedTokenizer
{
public static final char DEFAULT_DELIMITER = ',';
public static final char DEFAULT_QUOTE = '"';
public static final String WHITESPACE = " \t\n\r";
public DelimitedTokenizer(String input);
public DelimitedTokenizer(String input, char delim);
public DelimitedTokenizer(String input, char delim, char quote);
public char getDelim();
public void setDelim(char delim);
public char getQuote();
public void setQuote(char quote);
// defaults to true
public boolean isIgnoreLeadingWhitespace();
public void setIgnoreLeadingWhitespace(boolean ignoreLeadingWhitespace);
// defaults to true
public boolean isIgnoreTrailingWhitespace();
public void setIgnoreTrailingWhitespace(boolean
ignoreTrailingWhitespace);
// defaults to false
public boolean isTreatEmptyAsNull();
public void setTreatEmptyAsNull(boolean treatEmptyAsNull);
public int countTokens();
public String nextToken();
public void reset();
public String [] getAllTokens();
}
Now the question is how to submit it....
-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
Sent: Tuesday, November 11, 2003 2:28 PM
To: Jakarta Commons Developers List
Subject: Re: suggestion for new StringUtils.method
Inger, Matthew wrote:
> String [] undelimit(String input, char separatorChar, char quoteChar);
It's a tokenizer. It would be handy to have it as an iterator pattern too (like StringTokenizer).
J.Pietschmann
---------------------------------------------------------------------
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
Re: SUBMITING new StringUtils.method
Posted by "Todd V. Jonker" <To...@ConsciousCode.com>.
Agreed. Names should read like phrases.
On Tue, 11 Nov 2003 16:28:52 -0800, "Arun Thomas"
<ar...@paybytouch.com> said:
> The "is" methods read strangely to me. I think they may read better for
> both the "is" and "set" methods if the signatures were as follows:
>
> // defaults to true
> public boolean isIgnoringLeadingWhitespace();
> public void setIgnoringLeadingWhitespace(boolean
> ignoreLeadingWhitespace);
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org