Commons Lang
  1. Commons Lang
  2. LANG-471

I would like to add isLowerCase and isUpperCase methods to WordUtils in the commons.lang package

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.5
    • Component/s: lang.*
    • Labels:
      None

      Description

      public static boolean isLowerCase(String s)
      {
      if (s == null || s.trim().length() == 0) return false;

      char[] chars = new char[s.length()];
      s.getChars(0, s.length(), chars, 0);
      boolean ilc = true;
      for (int i = 0; i < chars.length; i++)
      {
      if (Character.isUpperCase(chars[i]))

      { ilc = false; break; }

      }

      return ilc;
      }

      public static boolean isUpperCase(String s)
      {
      if (s == null || s.trim().length() == 0) return false;

      char[] chars = new char[s.length()];
      s.getChars(0, s.length(), chars, 0);
      boolean iuc = true;
      for (int i = 0; i < chars.length; i++)
      {
      if (Character.isLowerCase(chars[i]))

      { iuc = false; break; }

      }

      return iuc;
      }

      1. LANG-471.patch
        4 kB
        Vincent Ricard

        Activity

        Hide
        James Carman added a comment -

        I don't know if it belongs in WordUtils. I'd say put it in StringUtils. You might also want to call them isAllUpperCase() or isAllLowerCase().

        Show
        James Carman added a comment - I don't know if it belongs in WordUtils. I'd say put it in StringUtils. You might also want to call them isAllUpperCase() or isAllLowerCase().
        Hide
        Ivica Mikic added a comment -

        Yes, StringUtils is more appropriate. What do I need to do to ensure it's included in the next version/release? Thanks.

        Show
        Ivica Mikic added a comment - Yes, StringUtils is more appropriate. What do I need to do to ensure it's included in the next version/release? Thanks.
        Hide
        James Carman added a comment -

        Providing a proper patch (with test cases) would be a great start.

        Show
        James Carman added a comment - Providing a proper patch (with test cases) would be a great start.
        Hide
        Vincent Ricard added a comment -

        Here is a patch.

        Show
        Vincent Ricard added a comment - Here is a patch.
        Hide
        Henri Yandell added a comment -

        Thanks Vincent.

        svn ci -m "Applying Vincent Ricard's patch in LANG-471 (reported by Ivica Mikic) adding isAllUpperCase and isAllLowerCase to StringUtils"

        Sending src/java/org/apache/commons/lang/StringUtils.java
        Sending src/test/org/apache/commons/lang/StringUtilsTest.java
        Transmitting file data ..
        Committed revision 789573.

        Show
        Henri Yandell added a comment - Thanks Vincent. svn ci -m "Applying Vincent Ricard's patch in LANG-471 (reported by Ivica Mikic) adding isAllUpperCase and isAllLowerCase to StringUtils" Sending src/java/org/apache/commons/lang/StringUtils.java Sending src/test/org/apache/commons/lang/StringUtilsTest.java Transmitting file data .. Committed revision 789573.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ivica Mikic
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.25h
              0.25h
              Remaining:
              Remaining Estimate - 0.25h
              0.25h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development