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

Shouldn't Commons Lang's StringUtils have a "common" string method?

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4
    • lang.*
    • None
    • generic

    Description

      A method which accepts a string array and returns a string which is the common portion of all the strings starting from the left, or more general form of that.

      This is very common operation. For example, one may want to find the common directory of a set of path strings.

      passing in:

      "/foo/f1.txt"
      "/foo/moo/f2.txt"
      "/foo/moo/f3.txt"

      should returns "/foo/"

      It is tedious to implement this in every project. And I think Commons Lang StringUtils should have some methods to help in this.

      Attachments

        1. StringUtils.patch
          10 kB
          Scott Johnson
        2. v2_StringUtils.java.patch
          7 kB
          Scott Johnson
        3. v2_StringUtilsTest.java.patch
          4 kB
          Scott Johnson

        Activity

          People

            Unassigned Unassigned
            mdang@interwoven.com Michael Dang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: