Example usage for android.text TextUtils isEmpty

List of usage examples for android.text TextUtils isEmpty

Introduction

In this page you can find the example usage for android.text TextUtils isEmpty.

Prototype

public static boolean isEmpty(@Nullable CharSequence str) 

Source Link

Document

Returns true if the string is null or 0-length.

Usage

From source file:Main.java

public static boolean isOTPOK(String otp_code) {
    if (TextUtils.isEmpty(otp_code)) {
        return false;
    }/*from ww  w . java 2  s . co  m*/

    return TextUtils.isDigitsOnly(otp_code) && (otp_code.length() == 4);
}

From source file:Main.java

public static String getWithMK(String str) {
    if (TextUtils.isEmpty(str))
        return null;
    int index = str.indexOf("@mk");
    if (index == -1)
        return str + "@mk";
    return str.substring(0, index + 3);
}

From source file:Main.java

public static boolean isEmpty(CharSequence chars) {
    return TextUtils.isEmpty(chars);
}

From source file:Main.java

public static String formatDecimal(String dec) {
    if (TextUtils.isEmpty(dec))
        return "";
    Double d = Double.parseDouble(dec);
    return String.format("%.1f", d);
}

From source file:Main.java

static boolean isValidEmail(CharSequence _Input) {
    return !TextUtils.isEmpty(_Input) && android.util.Patterns.EMAIL_ADDRESS.matcher(_Input).matches();
}

From source file:Main.java

public static boolean isValidEmail(String target) {
    return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
}

From source file:Main.java

public static boolean isAvailableVc(String vc) {
    if (!TextUtils.isEmpty(vc) && TextUtils.isDigitsOnly(vc) && vc.length() == 6) {
        return true;
    } else {// www  . jav  a  2  s.c o  m
        return false;
    }
}

From source file:Main.java

public static String getEleString(String ele) {
    if (TextUtils.isEmpty(ele)) {
        return "-";
    }/*w w  w.j a v  a 2s . c om*/

    return ele;
}

From source file:Main.java

public static String formatDecimal(String dec) {
    if (TextUtils.isEmpty(dec)) {
        return "";
    }/*ww  w .j  ava  2  s  .  c o m*/
    Double d = Double.parseDouble(dec);
    return String.format("%.1f", d);
}

From source file:Main.java

private static String getHashCode(String url) {
    if (!TextUtils.isEmpty(url)) {
        return String.valueOf(url.hashCode());
    }/*from   ww w  .  j ava  2  s  .  c  om*/
    return null;
}