You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/08/25 14:16:18 UTC

DO NOT REPLY [Bug 22692] New: - StringUtils.split ignores empty items

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22692>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22692

StringUtils.split ignores empty items

           Summary: StringUtils.split ignores empty items
           Product: Commons
           Version: 1.0.1 Final
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Lang
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: ludwig@riege.com


StringUtils.split ignores empty items (eg. delimiter at the beginning of the 
string, 2 delimiters directly after another)

Eg.

String[] l = StringUtils.split("X,DE,Germany", ",");
results in 
l[0] = "X"
l[1] = "DE"
l[2] = "Germany"

String[] l = StringUtils.split(",DE,Germany", ",");
results in
l[0] = "DE"
l[1] = "Germany"
expected : 
l[0] = "" (or null ?)
l[1] = "DE"
l[2] = "Germany"

The current behaviour makes it impossible to detect the "column" (eg. for 
parsing .csv files).