Create a bugzilla enhancement entry.




Inger, Matthew wrote:
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:[EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to