Example usage for java.lang CharSequence length

List of usage examples for java.lang CharSequence length

Introduction

In this page you can find the example usage for java.lang CharSequence length.

Prototype

int length();

Source Link

Document

Returns the length of this character sequence.

Usage

From source file:Main.java

public static CharSequence trimTrailingWhitespace(CharSequence text) {
    while (text.charAt(text.length() - 1) == '\n') {
        text = text.subSequence(0, text.length() - 1);
    }//from  w w w  . ja  v  a2  s  . c o  m

    return text;
}

From source file:Main.java

public static boolean isValidPassword(CharSequence target) {
    return target != null && target.length() > 5 && target.length() < 17;
}

From source file:Main.java

public static boolean isEmpty(CharSequence s) {
    return s == null || s.length() == 0;
}

From source file:Main.java

public static boolean isEmpty(CharSequence text) {
    if (text == null || text.length() == 0) {
        return true;
    }/*from   w  w  w.  java 2 s  .  c  o  m*/

    return false;
}

From source file:Main.java

public static boolean isEmpty(CharSequence str) {
    if (str == null || str.length() == 0)
        return true;
    else/*  ww  w . jav  a 2s  . com*/
        return false;
}

From source file:Main.java

/**
 * Tests if the text is null or 0-length
 * @param text//from  www  .j  a v  a 2s . c  o m
 * @return true if text is null or 0-length
 */
public static boolean isEmpty(CharSequence text) {
    return text == null || text.length() == 0;
}

From source file:Main.java

public static boolean isMatch(String regex, CharSequence input) {
    return input != null && input.length() > 0 && Pattern.matches(regex, input);
}

From source file:Main.java

public static void showShortMessage(Context mContext, CharSequence text) {
    if (text != null && text.length() > 0) {
        Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
    }/*from w w w.  j av a 2 s  .c o m*/
}

From source file:Main.java

/**
 * Check out if it is a empty data//from  w ww. j  a  v  a  2 s  .c o  m
 * @param data String
 * @return true if is empty
 */
public static boolean isEmpty(CharSequence data) {
    return data == null || data.length() == 0;
}

From source file:Main.java

public static void showLongMessage(Context mContext, CharSequence text) {
    if (text != null && text.length() > 0) {
        Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
    }/*from   w  ww  .  j  a va2  s  .com*/
}