Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-5

StringUtils.split ignores empty items

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.1
    • 2.1
    • lang.*
    • None
    • Operating System: other
      Platform: PC

    • 22692

    Description

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            ludwig@riege.com Guido Ludwig
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: