Using StringUtils.isEmpty().

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137806 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Fredrik Westermarck 2004-02-19 21:04:03 +00:00
parent a80c77930f
commit c2ee7dde50
5 changed files with 12 additions and 12 deletions

View File

@ -28,7 +28,7 @@
* @author Phil Steitz
* @author Gary Gregory
* @since 1.0
* @version $Id: CharSetUtils.java,v 1.31 2004/02/18 22:59:50 ggregory Exp $
* @version $Id: CharSetUtils.java,v 1.32 2004/02/19 21:04:03 fredrik Exp $
*/
public class CharSetUtils {
@ -222,7 +222,7 @@ public static String keep(String str, String set) {
if (str == null) {
return null;
}
if (str.length() == 0 || set == null || set.length() == 0) {
if (str.length() == 0 || StringUtils.isEmpty(set)) {
return "";
}
String[] strs = new String[1];

View File

@ -24,7 +24,7 @@
*
* @author Stephen Colebourne
* @since 2.1
* @version $Id: CharUtils.java,v 1.3 2004/02/18 22:59:50 ggregory Exp $
* @version $Id: CharUtils.java,v 1.4 2004/02/19 21:04:03 fredrik Exp $
*/
public class CharUtils {
@ -147,7 +147,7 @@ public static char toCharacter(Character ch, char defaultValue) {
* @throws IllegalArgumentException if the String is empty
*/
public static char toCharacter(String str) {
if (str == null || str.length() == 0) {
if (StringUtils.isEmpty(str)) {
throw new IllegalArgumentException("The String must not be empty");
}
return str.charAt(0);
@ -169,7 +169,7 @@ public static char toCharacter(String str) {
* @return the char value of the Character or the default if null
*/
public static char toCharacter(String str, char defaultValue) {
if (str == null || str.length() == 0) {
if (StringUtils.isEmpty(str)) {
return defaultValue;
}
return str.charAt(0);

View File

@ -28,7 +28,7 @@
* @author Eric Pugh
* @author Phil Steitz
* @since 1.0
* @version $Id: NumberUtils.java,v 1.16 2004/02/18 22:59:49 ggregory Exp $
* @version $Id: NumberUtils.java,v 1.17 2004/02/19 21:04:03 fredrik Exp $
*
* @deprecated Moved to org.apache.commons.lang.math.
* Class will be removed in Commons Lang 3.0.
@ -608,7 +608,7 @@ public static boolean isDigits(String str) {
* @return <code>true</code> if the string is a correctly formatted number
*/
public static boolean isNumber(String str) {
if ((str == null) || (str.length() == 0)) {
if (StringUtils.isEmpty(str)) {
return false;
}
char[] chars = str.toCharArray();

View File

@ -70,7 +70,7 @@
* @author Stephen Colebourne
* @author Gary D. Gregory
* @since 2.1
* @version $Id: Tokenizer.java,v 1.5 2004/02/18 22:59:50 ggregory Exp $
* @version $Id: Tokenizer.java,v 1.6 2004/02/19 21:04:03 fredrik Exp $
*/
public class Tokenizer implements ListIterator, Cloneable {
@ -566,7 +566,7 @@ private String[] readTokens() {
* @param tok the token to add
*/
private void addToken(List list, String tok) {
if (tok == null || tok.length() == 0) {
if (StringUtils.isEmpty(tok)) {
if (ignoreEmptyTokens) {
return;
}

View File

@ -35,7 +35,7 @@
* @author Gary Gregory
* @author Norm Deane
* @since 2.0
* @version $Id: Validate.java,v 1.10 2004/02/18 22:59:50 ggregory Exp $
* @version $Id: Validate.java,v 1.11 2004/02/19 21:04:03 fredrik Exp $
*/
public class Validate {
@ -356,7 +356,7 @@ public static void notEmpty(Map map) {
* @throws IllegalArgumentException if the string is empty
*/
public static void notEmpty(String string, String message) {
if (string == null || string.length() == 0) {
if (StringUtils.isEmpty(string)) {
throw new IllegalArgumentException(message);
}
}
@ -375,7 +375,7 @@ public static void notEmpty(String string, String message) {
* @throws IllegalArgumentException if the string is empty
*/
public static void notEmpty(String string) {
if (string == null || string.length() == 0) {
if (StringUtils.isEmpty(string)) {
throw new IllegalArgumentException("The validated string is empty");
}
}