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

Ambiguous / confusing names in StringUtils replace* methods

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.4
    • lang.*
    • None

    Description

      The recently added replaceEach* methods use "repl" for the original string list, and "with" for the new (replacement) string list.

      These names are rather confusing.

      RE engines tend to use words such as:

      Perl:
      searchlist
      replacementlist

      ORO:
      pattern
      replacement

      Java has String.replace(regex, replacement)

      In all cases, "replacement" is used for the NEW string, not the original string which is to be replaced.

      Seems to me that searchString/List and replacement[List] would be unambiguous as well as descriptive.
      Also useful in IDEs which show possible method completions.

      Changing the names of the parameters would not affect the API.

      Patch to follow

      Attachments

        1. StringUtils.patch
          11 kB
          Sebb

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: