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-sandbox/lang/src/java/org/apache/commons/lang Strings.java
Date Sun, 14 Jul 2002 02:28:15 GMT
bayard      2002/07/13 19:28:15

  Modified:    lang/src/java/org/apache/commons/lang Strings.java
  Log:
  Removed isLine and quoteRegularExpression.
  
  Revision  Changes    Path
  1.20      +1 -72     jakarta-commons-sandbox/lang/src/java/org/apache/commons/lang/Strings.java
  
  Index: Strings.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/lang/src/java/org/apache/commons/lang/Strings.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Strings.java	9 Jul 2002 21:06:05 -0000	1.19
  +++ Strings.java	14 Jul 2002 02:28:15 -0000	1.20
  @@ -1107,36 +1107,6 @@
           return buffer.toString();
       }
   
  -    /**
  -     * Quote a string so that it may be used in a regular expression 
  -     * without any parts of the string being considered as a 
  -     * part of the regular expression's control characters.
  -     */
  -    public static String quoteRegularExpression(String str) {
  -        // replace ? + * / . ^ $ as long as they're not in character 
  -        // class. so must be done by hand
  -        char[] chrs = str.toCharArray();
  -        int sz = chrs.length;
  -        StringBuffer buffer = new StringBuffer(2*sz);
  -        for(int i=0; i<sz; i++) {
  -            switch(chrs[i]) {
  -              case '[' :
  -              case ']' :
  -              case '?' :
  -              case '+' :
  -              case '*' :
  -              case '/' :
  -              case '.' :
  -              case '^' :
  -              case '$' :
  -                buffer.append("\\");
  -              default : 
  -                buffer.append(chrs[i]);
  -            }
  -        }
  -        return buffer.toString();
  -    }
  -
       // Padding
       //--------------------------------------------------------------------------
       
  @@ -1607,47 +1577,6 @@
               if ((Character.isDigit(str.charAt(i)) == false) &&
                   (str.charAt(i) != ' ')) {
                   return false;
  -            }
  -        }
  -        return true;
  -    }
  -
  -    /**
  -     * Is a String a line, containing only letters, digits or 
  -     * whitespace, and ending with an optional newline.
  -     * Punctuation is not allowed. Null returns false.
  -     * 
  -     * @param str  the string to check
  -     * @return true if only contains digits or space, and is non-null
  -     */
  -    public static boolean isLine(String str) {
  -        if (str == null) {
  -            return false;
  -        }
  -        char ch = 0;
  -        char[] chrs = str.toCharArray();
  -        int sz = chrs.length - 1;
  -        for (int i = 0; i < sz - 2; i++) {
  -            if (Character.isLetterOrDigit(chrs[i]) == false) {
  -                if (Character.isWhitespace(chrs[i]) == false) {
  -                    return false;
  -                }
  -            }
  -        }
  -        if (Character.isLetterOrDigit(chrs[sz - 1]) == false) {
  -            if (Character.isWhitespace(chrs[sz - 1]) == false) {
  -                if (chrs[sz - 1] != '\r') {
  -                    return false;
  -                } else if (chrs[sz] != '\n') {
  -                    return false;
  -                }
  -            }
  -        }
  -        if (Character.isLetterOrDigit(chrs[sz]) == false) {
  -            if (Character.isWhitespace(chrs[sz]) == false) {
  -                if (chrs[sz] != '\n') {
  -                    return false;
  -                }
               }
           }
           return true;
  
  
  

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


Mime
View raw message