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 String getFIOShort(String f, String i, String o) {

    return ((f == null ? "" : (f.trim() + ' '))
            + (i != null && !i.trim().isEmpty() ? i.trim().substring(0, 1) + '.' : "")
            + (o != null && !o.trim().isEmpty() ? o.trim().substring(0, 1) + '.' : "")).trim();
}

From source file:Main.java

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

From source file:Main.java

public static Boolean isNotNull(String str) {
    if (str == null || str == "" || str.trim().length() <= 0) {
        return false;
    } else/*from ww  w. j  a  va2  s .  com*/
        return true;
}

From source file:com.lankr.tv_cloud.support.qcloud.image.PicProcessSign.java

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

From source file:Main.java

public static boolean notEmpty(String s) {
    return s != null && !TextUtils.isEmpty(s.trim());
}

From source file:Main.java

public static boolean isEmpty(String value) {
    if (value != null && !"".equalsIgnoreCase(value.trim()) && !"null".equalsIgnoreCase(value.trim())) {
        return false;
    } else {/*  ww w  .  ja v a 2 s.  c o m*/
        return true;
    }
}

From source file:Main.java

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

From source file:Main.java

private static boolean Regular(String str, String pattern) {
    if (null == str || str.trim().length() <= 0)
        return false;
    Pattern p = Pattern.compile(pattern);
    Matcher m = p.matcher(str);/*from   w w w. ja  v  a 2  s.  c  o m*/
    return m.matches();
}

From source file:Main.java

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

From source file:Main.java

public static boolean comparePhones(String phone1, String phone2) {
    return PhoneNumberUtils.compare(phone1.trim(), phone2.trim());
}