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

last substring returned by StringUtils.split( String, String, int ) is too long

    XMLWordPrintableJSON

Details

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

    • 24911

    Description

      My expectations for the behavior of the split( *, ..., int max ) methods don't
      match their actual behavior. I expected to get a maximum of "max" substrings,
      all of which were delimited in the parent string by the specified delimiters.
      Instead, what you get is "max - 1" such substrings, plus the rest of the parent
      string as the final result substring. This behavior seems counter to what
      StringTokenizer would do, which is surprising, given the Javadoc comments about
      using the split methods as alternatives to StringTokenizer.

      Attachments

        Activity

          People

            Unassigned Unassigned
            hotfusionman@yahoo.com Albert Davidson Chou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: