commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Inger, Matthew" <in...@Synygy.com>
Subject RE: suggestion for new StringUtils.method
Date Tue, 11 Nov 2003 20:04:46 GMT
The double versus single quotes i don't see as an issue.
If you specify " as your quote character, then ' is treated
just like any other character, and vice versa.  This may be
Pascal style doubling, but it's the same approach taken by
excel and many other programs to allow for the quote character
in the string itself.

You're suggestion of the tokenizer does make sense from the
configuration point of view, and I'll look into it.



-----Original Message-----
From: Todd V. Jonker [mailto:Todd@ConsciousCode.com]
Sent: Tuesday, November 11, 2003 2:28 PM
To: Jakarta Commons Developers List
Subject: RE: suggestion for new StringUtils.method


THe problem I see is in specifying the quoting semantics to make the
method generally useful.

How do you handle double- versus single-quotes?  Perhaps only one or the
other should work.

Your example shows Pascal-style doubling to include quote characters, but
why not backslash?

Why treat undelimit("foo,,bar") the same as undelimit("foo, ,bar")?

Perhaps I don't want the ourput trimmed?

It seems like all of these variants would be needed in some scenario.

This isn't to say that I don't want this functionality (I know exactly
where I could use it) but I think it will take some careful design
thought and quote a bit of tweakability.  In which case a Tokenizer would
be better than a StringUtils method, because one could set properties on
the Tokenizer and avoid combinatoric parameter problems.

.T.


On Tue, 11 Nov 2003 13:14:22 -0500, "Inger, Matthew" <inger@Synygy.com>
said:
> In the case here, i don't think there's a conceptual
> difference between blank and null.  And by "blank", i
> mean a string of length 0.  Since whitespace is stripped,
> if i return a null instead, you would never get an empty
> string back.  Better to let the user decide to use empty
> string or null once they get the results back.
> 
> 
> -----Original Message-----
> From: Gerry Duprey [mailto:gduprey@Schools-OPEN.com]
> Sent: Tuesday, November 11, 2003 1:08 PM
> To: Jakarta Commons Developers List
> Subject: Re: suggestion for new StringUtils.method
> 
> 
> Howdy,
> 
> > String [] undelimit(String input, char separatorChar, char quoteChar);
> > 
> > a, , b, "c,d,e", "f""g""h",
> > 
> > would return the following tokens:
> > 
> > 1- a
> > 2- <blank>
> > 3- b
> 
> Very handy.  I'd suggest that in the above case, the 2nd & 6th entry
> return
> a 
> null.  There are times you need to know that there basically wasn't any
> data
> 
> (and empty element) which could be different from a empty string (i.e.
> "").
> 
> Just a thought.
> 
> Gerry
> 
> -- 
> Gerry Duprey
> ________________________________________
> SchoolsOPEN, LLC
> 123 North Ashley, Suite 120
> Ann Arbor, MI 48104
> Phone (877) 483-1944 Ext. 401
> Fax (734) 661-0819
> 
> Visit us Online at www.Schools-OPEN.com
> 
> 
> ---------------------------------------------------------------------
> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message