commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Al Chou <hotfusion...@yahoo.com>
Subject RE: suggestion for new StringUtils.method
Date Tue, 11 Nov 2003 21:46:44 GMT
This thread is a good entree for my question.  I was adding a new
StringUtils.split method that can split a string using a whole string as the
delimiter, rather than the characters within that string.  In running my JUnit
tests, I discovered unexpected behavior in the existing method:

String stringToSplitOnNulls = "ab   de fg" ;
String[] splitOnNullExpectedResults = { "ab", "de" } ;

String[] splitOnNullResults = StringUtils.split( stringToSplitOnNulls, null, 2
) ;
assertEquals( splitOnNullExpectedResults.length, splitOnNullResults.length ) ;
for ( int i = 0 ; i < splitOnNullExpectedResults.length ; i+= 1 )
{
    assertEquals( splitOnNullExpectedResults[i], splitOnNullResults[i] ) ;
}


The result of the split call is

"ab", "de fg"

and it doesn't look to me like StringTokenizer's documentation implies this
behavior....


Al

=====
Albert Davidson Chou

    Get answers to Mac questions at http://www.Mac-Mgrs.org/ .

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------------------------------------------------
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