dlr         01/08/26 12:38:27

  Modified:    util/src/java/org/apache/commons/util StringUtils.java
  Log:
  Optimized and deprecated removeUnderScores() -- it's way too specific
  a method.  Use replace() instead.
  
  Revision  Changes    Path
  1.13      +11 -18    
jakarta-commons-sandbox/util/src/java/org/apache/commons/util/StringUtils.java
  
  Index: StringUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/util/src/java/org/apache/commons/util/StringUtils.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -u -r1.12 -r1.13
  --- StringUtils.java  2001/08/26 19:28:54     1.12
  +++ StringUtils.java  2001/08/26 19:38:27     1.13
  @@ -81,7 +81,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Greg Coladonato</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Bayard</a>
  - * @version $Id: StringUtils.java,v 1.12 2001/08/26 19:28:54 dlr Exp $
  + * @version $Id: StringUtils.java,v 1.13 2001/08/26 19:38:27 dlr Exp $
    */
   public class StringUtils
   {
  @@ -114,12 +114,12 @@
        * Validates that the supplied string is neither <code>null</code>
        * nor the empty string.
        *
  -     * @param foo The text to check.
  +     * @param text The text to check.
        * @return Whether valid.
        */
  -    public static final boolean isValid(String foo)
  +    public static final boolean isValid(String text)
       {
  -        return (foo != null && foo.length() > 0);
  +        return (text != null && text.length() > 0);
       }
   
       /**
  @@ -194,22 +194,15 @@
       }
   
       /**
  -     * Remove Underscores from a string and replaces first
  -     * Letters with Capitals.  foo_bar becomes FooBar
  +     * Removes underscores from text.
  +     *
  +     * @param text The text to remove any underscores from.
  +     * @return The underscore-less text.
  +     * @deprecated Use replace(String, String, String) instead.
        */
  -    public static String removeUnderScores (String data)
  +    public static String removeUnderScores(String text)
       {
  -        String temp = null;
  -        StringBuffer out = new StringBuffer();
  -        temp = data;
  -
  -        StringTokenizer st = new StringTokenizer(temp, "_");
  -        while (st.hasMoreTokens())
  -        {
  -            String element = (String) st.nextElement();
  -            out.append ( firstLetterCaps(element));
  -        }
  -        return out.toString();
  +        return replace(text, "_", "", -1);
       }
   
       /**
  
  
  

Reply via email to