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

[lang][patch] Add StringUtils.nIndexOf?

    XMLWordPrintableJSON

Details

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

    • 22719

    Description

      We have indexOf(String, String), lastIndexOf(String, String) but no method to
      pick of a specific n-th occurrence (I need the 2nd one for example). So I
      propose to add (post 2.0):

      nIndexOf(String, String, int).

      I am not in love with the method name, but what else to call it? It does fit in
      the pattern <occurrence>IndexOf() that the other methods have, where indexOf()
      is really firstIndexOf(). Alternatives?:

      nThIndexOf(String, String, int) - kinda weird
      countIndexOf(String, String, int) - weirder
      indexOfOccurrence(String, String, int) - a bit wordy but ok.
      indexOfAt(String, String, int) - short; confusing?
      indexOfStringAt(String, String, int) - we got rid of "String" in a bunch of
      method names already, odd to reintroduce?

      Attachments

        Activity

          People

            Unassigned Unassigned
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: