commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang StringUtilsTest.java
Date Thu, 14 Aug 2003 00:04:20 GMT
bayard      2003/08/13 17:04:20

  Modified:    lang/src/java/org/apache/commons/lang StringUtils.java
               lang/src/test/org/apache/commons/lang StringUtilsTest.java
  Log:
  Deprecated the 'capitalise' spelling and introduced the 'capitalize' spelling.
  Despite the UK [or international] English base of many of the developers on
  Lang, it was felt that it would be better to match Jakarta as a whole.
  
  Also none of us cared enough to make it an issue.
  
  Revision  Changes    Path
  1.94      +60 -32    jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java
  
  Index: StringUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- StringUtils.java	13 Aug 2003 23:30:58 -0000	1.93
  +++ StringUtils.java	14 Aug 2003 00:04:20 -0000	1.94
  @@ -84,7 +84,7 @@
    *      - removes the last part of a String
    *  <li><b>LeftPad/RightPad/Center/Repeat</b>
    *      - pads a String
  - *  <li><b>UpperCase/LowerCase/SwapCase/Capitalise/Uncapitalise</b>
  + *  <li><b>UpperCase/LowerCase/SwapCase/Capitalize/Uncapitalize</b>
    *      - change the case of a String
    *  <li><b>NestedString</b>
    *      - returns a substring nested within other Strings
  @@ -3410,22 +3410,22 @@
       }
   
       /**
  -     * <p>Capitalises a String changing the first letter to title case as
  +     * <p>Capitalizes a String changing the first letter to title case as
        * per {@link Character#toTitleCase(char)}. No other letters are changed.</p>
        * 
        * <p>A <code>null</code> input String returns <code>null</code>.</p>
        * 
        * <pre>
  -     * StringUtils.capitalise(null)  = null
  -     * StringUtils.capitalise("")    = ""
  -     * StringUtils.capitalise("cat") = "Cat"
  -     * StringUtils.capitalise("cAt") = "CAt"
  +     * StringUtils.capitalize(null)  = null
  +     * StringUtils.capitalize("")    = ""
  +     * StringUtils.capitalize("cat") = "Cat"
  +     * StringUtils.capitalize("cAt") = "CAt"
        * </pre>
        * 
  -     * @param str  the String to capitalise, may be null
  -     * @return the capitalised String, <code>null</code> if null String input
  +     * @param str  the String to capitalize, may be null
  +     * @return the capitalized String, <code>null</code> if null String input
        */
  -    public static String capitalise(String str) {
  +    public static String capitalize(String str) {
           int strLen;
           if (str == null || (strLen = str.length()) == 0) {
               return str;
  @@ -3437,22 +3437,29 @@
       }
   
       /**
  -     * <p>Uncapitalises a String changing the first letter to title case as
  +     * @deprecated Use the standardly named {@link #capitalize(String)}.
  +     */
  +    public static String capitalise(String str) {
  +        return capitalize(str);
  +    }
  +
  +    /**
  +     * <p>Uncapitalizes a String changing the first letter to title case as
        * per {@link Character#toLowerCase(char)}. No other letters are changed.</p>
        * 
        * <p>A <code>null</code> input String returns <code>null</code>.</p>
        * 
        * <pre>
  -     * StringUtils.uncapitalise(null)  = null
  -     * StringUtils.uncapitalise("")    = ""
  -     * StringUtils.uncapitalise("Cat") = "cat"
  -     * StringUtils.uncapitalise("CAT") = "cAT"
  +     * StringUtils.uncapitalize(null)  = null
  +     * StringUtils.uncapitalize("")    = ""
  +     * StringUtils.uncapitalize("Cat") = "cat"
  +     * StringUtils.uncapitalize("CAT") = "cAT"
        * </pre>
        * 
  -     * @param str  the String to uncapitalise, may be null
  -     * @return the uncapitalised String, <code>null</code> if null String input
  +     * @param str  the String to uncapitalize, may be null
  +     * @return the uncapitalized String, <code>null</code> if null String input
        */
  -    public static String uncapitalise(String str) {
  +    public static String uncapitalize(String str) {
           int strLen;
           if (str == null || (strLen = str.length()) == 0) {
               return str;
  @@ -3464,6 +3471,13 @@
       }
   
       /**
  +     * @deprecated Use the standardly named {@link #uncapitalize(String)}.
  +     */
  +    public static String uncapitalise(String str) {
  +        return uncapitalize(str);
  +    }
  +
  +    /**
        * <p>Swaps the case of a String using a word based algorithm.</p>
        * 
        * <ul>
  @@ -3518,22 +3532,22 @@
       }
   
       /**
  -     * <p>Capitalises all the whitespace separated words in a String.
  +     * <p>Capitalizes all the whitespace separated words in a String.
        * Only the first letter of each word is changed.</p>
        *
        * <p>Whitespace is defined by {@link Character#isWhitespace(char)}.
        * A <code>null</code> input String returns <code>null</code>.</p>
        *
        * <pre>
  -     * StringUtils.capitaliseAllWords(null)        = null
  -     * StringUtils.capitaliseAllWords("")          = ""
  -     * StringUtils.capitaliseAllWords("i am FINE") = "I Am FINE"
  +     * StringUtils.capitalizeAllWords(null)        = null
  +     * StringUtils.capitalizeAllWords("")          = ""
  +     * StringUtils.capitalizeAllWords("i am FINE") = "I Am FINE"
        * </pre>
        * 
  -     * @param str  the String to capitalise, may be null
  -     * @return capitalised String, <code>null</code> if null String input
  +     * @param str  the String to capitalize, may be null
  +     * @return capitalized String, <code>null</code> if null String input
        */
  -    public static String capitaliseAllWords(String str) {
  +    public static String capitalizeAllWords(String str) {
           int strLen;
           if (str == null || (strLen = str.length()) == 0) {
               return str;
  @@ -3556,22 +3570,29 @@
       }
   
       /**
  -     * <p>Uncapitalises all the whitespace separated words in a String.
  +     * @deprecated Use the standardly named {@link #capitalize(String)}.
  +     */
  +    public static String capitaliseAllWords(String str) {
  +        return capitalizeAllWords(str);
  +    }
  +
  +    /**
  +     * <p>Uncapitalizes all the whitespace separated words in a String.
        * Only the first letter of each word is changed.</p>
        *
        * <p>Whitespace is defined by {@link Character#isWhitespace(char)}.
        * A <code>null</code> input String returns <code>null</code>.</p>
        *
        * <pre>
  -     * StringUtils.uncapitaliseAllWords(null)        = null
  -     * StringUtils.uncapitaliseAllWords("")          = ""
  -     * StringUtils.uncapitaliseAllWords("I Am FINE") = "i am fINE"
  +     * StringUtils.uncapitalizeAllWords(null)        = null
  +     * StringUtils.uncapitalizeAllWords("")          = ""
  +     * StringUtils.uncapitalizeAllWords("I Am FINE") = "i am fINE"
        * </pre>
        * 
  -     * @param str  the String to uncapitalise, may be null
  -     * @return uncapitalised String, <code>null</code> if null String input
  +     * @param str  the String to uncapitalize, may be null
  +     * @return uncapitalized String, <code>null</code> if null String input
        */
  -    public static String uncapitaliseAllWords(String str) {
  +    public static String uncapitalizeAllWords(String str) {
           int strLen;
           if (str == null || (strLen = str.length()) == 0) {
               return str;
  @@ -3591,6 +3612,13 @@
               }
           }
           return buffer.toString();
  +    }
  +
  +    /**
  +     * @deprecated Use the standardly named {@link #uncapitalize(String)}.
  +     */
  +    public static String uncapitaliseAllWords(String str) {
  +        return uncapitalizeAllWords(str);
       }
   
       // Count matches
  
  
  
  1.47      +26 -26    jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java
  
  Index: StringUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- StringUtilsTest.java	13 Aug 2003 23:08:06 -0000	1.46
  +++ StringUtilsTest.java	14 Aug 2003 00:04:20 -0000	1.47
  @@ -162,31 +162,31 @@
           assertEquals(null, StringUtils.upperCase(null));
           assertEquals(null, StringUtils.lowerCase(null));
           assertEquals(null, StringUtils.swapCase(null));
  -        assertEquals(null, StringUtils.capitalise(null));
  -        assertEquals(null, StringUtils.uncapitalise(null));
  -        assertEquals(null, StringUtils.capitaliseAllWords(null));
  -        assertEquals(null, StringUtils.uncapitaliseAllWords(null));
  +        assertEquals(null, StringUtils.capitalize(null));
  +        assertEquals(null, StringUtils.uncapitalize(null));
  +        assertEquals(null, StringUtils.capitalizeAllWords(null));
  +        assertEquals(null, StringUtils.uncapitalizeAllWords(null));
   
  -        assertEquals("capitalise(String) failed",
  -                     CAP_FOO, StringUtils.capitalise(FOO) );
  -        assertEquals("capitalise(empty-string) failed",
  -                     "", StringUtils.capitalise("") );
  -        assertEquals("capitalise(single-char-string) failed",
  -                     "X", StringUtils.capitalise("x") );
  -        assertEquals("capitaliseAllWords(String) failed",
  -                     "Foo Bar Baz", StringUtils.capitaliseAllWords(SENTENCE) );
  -        assertEquals("capitaliseAllWords(empty-string) failed",
  -                     "", StringUtils.capitaliseAllWords("") );
  -        assertEquals("uncapitalise(String) failed",
  -                     FOO, StringUtils.uncapitalise(CAP_FOO) );
  -        assertEquals("uncapitalise(empty-string) failed",
  -                     "", StringUtils.uncapitalise("") );
  -        assertEquals("uncapitalise(single-char-string) failed",
  -                     "x", StringUtils.uncapitalise("X") );
  -        assertEquals("uncapitaliseAllWords(String) failed",
  -                     SENTENCE, StringUtils.uncapitaliseAllWords("Foo Bar Baz") );
  -        assertEquals("uncapitaliseAllWords(empty-string) failed",
  -                     "", StringUtils.uncapitaliseAllWords("") );
  +        assertEquals("capitalize(String) failed",
  +                     CAP_FOO, StringUtils.capitalize(FOO) );
  +        assertEquals("capitalize(empty-string) failed",
  +                     "", StringUtils.capitalize("") );
  +        assertEquals("capitalize(single-char-string) failed",
  +                     "X", StringUtils.capitalize("x") );
  +        assertEquals("capitalizeAllWords(String) failed",
  +                     "Foo Bar Baz", StringUtils.capitalizeAllWords(SENTENCE) );
  +        assertEquals("capitalizeAllWords(empty-string) failed",
  +                     "", StringUtils.capitalizeAllWords("") );
  +        assertEquals("uncapitalize(String) failed",
  +                     FOO, StringUtils.uncapitalize(CAP_FOO) );
  +        assertEquals("uncapitalize(empty-string) failed",
  +                     "", StringUtils.uncapitalize("") );
  +        assertEquals("uncapitalize(single-char-string) failed",
  +                     "x", StringUtils.uncapitalize("X") );
  +        assertEquals("uncapitalizeAllWords(String) failed",
  +                     SENTENCE, StringUtils.uncapitalizeAllWords("Foo Bar Baz") );
  +        assertEquals("uncapitalizeAllWords(empty-string) failed",
  +                     "", StringUtils.uncapitalizeAllWords("") );
   
           assertEquals("upperCase(String) failed",
                        "FOO TEST THING", StringUtils.upperCase("fOo test THING") );
  
  
  

Mime
View raw message