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 isStringNullOrEmpty(String str) {
    if (str == null || str.trim().equals(""))
        return true;
    return false;
}

From source file:Main.java

public static void copy2Clipboard(Context context, String content) {
    content = content.trim();
    ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    cmb.setText(content.trim());/*w  w  w  . j  a  va 2s  .  co  m*/
}

From source file:Main.java

public static boolean isEmptyNotNull(String str) {
    if (str == null || str.trim().equals(""))
        return true;
    return false;
}

From source file:Main.java

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

From source file:Main.java

public static float str2float(String str) {
    return Float.parseFloat(str.trim());
}

From source file:Main.java

public static boolean isNotBlank(String str) {
    return (str != null && str.trim().length() != 0);
}

From source file:Main.java

public static boolean isNicknameValid(String nickname) {
    String trimmed = nickname.trim();
    return !(trimmed.isEmpty() || trimmed.contains(" "));
}

From source file:Main.java

public static boolean islengthValid(String iString) {
    iString = iString.trim();
    boolean result = false;
    if (iString.length() > 0) {
        result = true;/*from ww w . j  av a2 s .c  o m*/
    }
    return result;
}

From source file:Main.java

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

From source file:Main.java

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