Example usage for java.lang String trim

List of usage examples for java.lang String trim

Introduction

In this page you can find the example usage for java.lang String trim.

Prototype

public String trim() 

Source Link

Document

Returns a string whose value is this string, with all leading and trailing space removed, where space is defined as any character whose codepoint is less than or equal to 'U+0020' (the space character).

Usage

From source file:Main.java

public static boolean isAddressDetail(String str) {
    if (str != null && (!str.trim().equals("")) && (str.length() > 3) && (str.length() < 21)) {
        return true;
    } else {/*from   www .  j a  v  a2  s  .c o m*/
        return false;
    }
}

From source file:Main.java

public static boolean isEmpty(String s) {
    return s == null || "".equals(s.trim()) || "null".equals(s.trim().toLowerCase());
}

From source file:Main.java

public static boolean isMucNickNameLegal(String nickName) {
    nickName = nickName.trim();
    String name = nickName.replaceAll("[^a-zA-Z0-9_@~!,\\[\\]\\-=+#\'\";?()!*\\s]", "**");
    int len = name.length();
    if (len == 0 || (len >= 2 && len <= 20)) {
        return true;
    }//ww w .j a  va  2  s.  c o  m
    return false;
}

From source file:Main.java

public static boolean isInfook(String str) {
    if (str != null && (!str.trim().equals("")) && (str.length() > 10) && (str.length() < 1000)) {
        return true;
    } else {//w ww .  ja  va2s.c om
        return false;
    }
}

From source file:Main.java

public static boolean isLong(String str) {
    if ("0".equals(str.trim())) {
        return true;
    }/*from w  w w  .  jav  a2 s  .c  om*/
    Pattern pattern = Pattern.compile("^[^0]\\d*");
    Matcher isNum = pattern.matcher(str);
    return isNum.matches();
}

From source file:Main.java

public static boolean isNotEmpty(String s) {
    return s != null && !"".equals(s.trim());
}

From source file:Main.java

public static boolean isEmpty(String str) {
    if (str != null && (!str.trim().equals(""))) {
        return true;
    } else {//from  www  .  j a va 2s .c  om
        return false;
    }
}

From source file:Main.java

public static boolean isEmptyString(String value) {
    return !(value != null && !value.trim().isEmpty());
}

From source file:Main.java

public static boolean nullOrEmptyStr(String string) {
    return (string != null && !string.trim().isEmpty() ? false : true);
}

From source file:Main.java

public static boolean isEmpty(String text) {
    return text == null || text.trim().length() == 0;
}