Re: Bug in String's split method???
- From: castillo.bryan@xxxxxxxxx
- Date: 27 Jun 2005 17:21:22 -0700
Yes I saw that part, but the part that throws me is the limit
parameter. Here are the docs on that. Not the asterisks.
The limit parameter controls the number of times the pattern is
applied and therefore affects the length of the resulting array. If the
limit n is greater than zero then the pattern will be applied at most n
- 1 times, the array's length will be no greater than n, and the
array's last entry will contain all input beyond the last matched
delimiter. If n is non-positive then the pattern will be applied as
many times as possible and the array can have any length. *If n is zero
then the pattern will be applied as many times as possible, the array
can have any length, and trailing empty strings will be discarded.*
------
I think that the poriton you emphasized "f the expression does not
match any part of the input then the resulting array has just one
element,
namely this string." and the portion I emphasized "If n is zero then
the pattern will be applied as many times as possible, the array can
have any length, and trailing empty strings will be discarded."
conflict with eachother in the case
"".split(",", 0);
The limit was zero so the empty trailing field should have been
discarded. I could read the docs both ways. The docs are ambiguous on
this feature.
.
- Follow-Ups:
- Re: Bug in String's split method???
- From: Virgil Green
- Re: Bug in String's split method???
- References:
- Bug in String's split method???
- From: castillo . bryan
- Re: Bug in String's split method???
- From: Virgil Green
- Bug in String's split method???
- Prev by Date: Re: Problem with viewToModel()
- Next by Date: Re: Problem Running Application (Java + JExcel API)
- Previous by thread: Re: Bug in String's split method???
- Next by thread: Re: Bug in String's split method???
- Index(es):
Relevant Pages
|