Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 65318 invoked from network); 4 Nov 2003 21:00:26 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 4 Nov 2003 21:00:26 -0000 Received: (qmail 58559 invoked by uid 500); 4 Nov 2003 21:00:14 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 58192 invoked by uid 500); 4 Nov 2003 21:00:12 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 58177 invoked by uid 500); 4 Nov 2003 21:00:12 -0000 Received: (qmail 58174 invoked from network); 4 Nov 2003 21:00:12 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 4 Nov 2003 21:00:12 -0000 Received: (qmail 65283 invoked by uid 1749); 4 Nov 2003 21:00:22 -0000 Date: 4 Nov 2003 21:00:22 -0000 Message-ID: <20031104210022.65282.qmail@minotaur.apache.org> From: fredrik@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringUtils.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N fredrik 2003/11/04 13:00:22 Modified: lang/src/java/org/apache/commons/lang StringUtils.java Log: Using StringUtils.isEmpty() when testing Strings. Renamed the parameter string to the more commonly used str in removeStart() and removeEnd. Revision Changes Path 1.117 +15 -15 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.116 retrieving revision 1.117 diff -u -r1.116 -r1.117 --- StringUtils.java 3 Nov 2003 03:48:59 -0000 1.116 +++ StringUtils.java 4 Nov 2003 21:00:22 -0000 1.117 @@ -1114,7 +1114,7 @@ * @since 2.0 */ public static int indexOfAny(String str, char[] searchChars) { - if (str == null || str.length() == 0 || searchChars == null || searchChars.length == 0) { + if (StringUtils.isEmpty(str) || searchChars == null || searchChars.length == 0) { return -1; } for (int i = 0; i < str.length(); i++) { @@ -1151,7 +1151,7 @@ * @since 2.0 */ public static int indexOfAny(String str, String searchChars) { - if (str == null || str.length() == 0 || searchChars == null || searchChars.length() == 0) { + if (StringUtils.isEmpty(str) || StringUtils.isEmpty(searchChars)) { return -1; } return indexOfAny(str, searchChars.toCharArray()); @@ -2485,14 +2485,14 @@ * null if null String input * @since 2.1 */ - public static String removeStart(String string, String remove) { - if (string == null || string.length() == 0 || remove == null || remove.length() == 0) { - return string; + public static String removeStart(String str, String remove) { + if (StringUtils.isEmpty(str) || StringUtils.isEmpty(remove)) { + return str; } - if (string.startsWith(remove)){ - return string.substring(remove.length()); + if (str.startsWith(remove)){ + return str.substring(remove.length()); } - return string; + return str; } /** @@ -2519,14 +2519,14 @@ * null if null String input * @since 2.1 */ - public static String removeEnd(String string, String remove) { - if (string == null || string.length() == 0 || remove == null || remove.length() == 0) { - return string; + public static String removeEnd(String str, String remove) { + if (StringUtils.isEmpty(str) || StringUtils.isEmpty(remove)) { + return str; } - if (string.endsWith(remove)) { - return string.substring(0, string.length() - remove.length()); + if (str.endsWith(remove)) { + return str.substring(0, str.length() - remove.length()); } - return string; + return str; } // Replacing --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org