commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <ggreg...@seagullsw.com>
Subject RE: [lang] split & join
Date Fri, 13 Feb 2004 05:49:29 GMT
Would adding a Javadoc pointer to Tokenizer be helpful?

Gary

> -----Original Message-----
> From: Inger, Matthew [mailto:inger@Synygy.com]
> Sent: Thursday, February 12, 2004 10:34
> To: 'Jakarta Commons Developers List'
> Subject: RE: [lang] split & join
> 
> Look at the new "Tokenizer" class.  It will handle CSV records,
> and has the following options:  treat empty tokens as null values,
> ignore empty/null tokens, along with some other stuff.
> 
> 
> 
> -----Original Message-----
> From: Emmanuel Bourg [mailto:ebourg@micropole-univers.com]
> Sent: Thursday, February 12, 2004 12:27 PM
> To: Jakarta Commons Developers List
> Subject: [lang] split & join
> 
> 
> Hi, i noticed that the split method in StringUtils is not the reverse
> operation of join, is this intended ? The split method treats adjacent
> separators as one separator unlike the Perl and JDK 1.4 split functions.
> That means it's not possible to join an array and then split the result
> to get a similar array, that's quite annoying when manipulating CSV
> records. For example:
> 
> String[] tab1 = new String[] { "a", "b", "", "d" };
> 
> String[] tab2 = StringUtils.split(StringUtils.join(tab1, ';'), ';');
> 
> here tab2 = { "a", "b", "d" }, the 3rd element of tab1 is lost.
> 
> That may be nice to have a flag on the split methods indicating if the
> separators must be merged, or a new set of methods (slice()?) with the
> same signatures and handling empty elements.
> 
> Emmanuel Bourg
> 
> 
> ---------------------------------------------------------------------
> 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