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/java/org/apache/commons/lang WordUtils.java
Date Thu, 03 Jun 2004 03:08:33 GMT
bayard      2004/06/02 20:08:33

  Modified:    lang/src/java/org/apache/commons/lang WordUtils.java
  Log:
  simplified the implementation of capitalizeFully
  
  Revision  Changes    Path
  1.10      +4 -18     jakarta-commons/lang/src/java/org/apache/commons/lang/WordUtils.java
  
  Index: WordUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/WordUtils.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- WordUtils.java	18 Feb 2004 22:59:50 -0000	1.9
  +++ WordUtils.java	3 Jun 2004 03:08:33 -0000	1.10
  @@ -278,25 +278,11 @@
        * @return capitalized String, <code>null</code> if null String input
        */
       public static String capitalizeFully(String str) {
  -        int strLen;
  -        if (str == null || (strLen = str.length()) == 0) {
  +        if (str == null || str.length() == 0) {
               return str;
           }
  -        StringBuffer buffer = new StringBuffer(strLen);
  -        boolean whitespace = true;
  -        for (int i = 0; i < strLen; i++) {
  -            char ch = str.charAt(i);
  -            if (Character.isWhitespace(ch)) {
  -                buffer.append(ch);
  -                whitespace = true;
  -            } else if (whitespace) {
  -                buffer.append(Character.toTitleCase(ch));
  -                whitespace = false;
  -            } else {
  -                buffer.append(Character.toLowerCase(ch));
  -            }
  -        }
  -        return buffer.toString();
  +        str = str.toLowerCase();
  +        return capitalize(str);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message