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

ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1 (correct answer should be 0)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4
    • 3.5
    • None
    • None
    • OS X Yosemite 10.10.5. Maven project.

    Description

      In Apache Commons Lang 3.4, StringUtils.ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1 (correct answer should be 0)。but StringUtils.ordinalIndexOf("abc", "a", 1) gives correct answer of 0.

      Based on the above mentioned observation, the bug occurrs if the searchStr is of length > 1, and locates at the index 0 of the str.

      In Apache Commons Lang 2.6, this bug is not observed.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              qin.li@everydayratings.com Qin Li
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: