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

/**
 * Returns true if the string is null or 0-length.
 * @param str the string to be examined//from  ww  w .ja  v a 2 s.  c om
 * @return true if str is null or zero length
 */
public static boolean isEmpty(@Nullable CharSequence str) {
    return str == null || str.length() == 0;
}

From source file:Main.java

public static int nmeaChecksum(CharSequence nmea, int startIndex) {
    int length = nmea.length();
    return nmeaChecksum(nmea, startIndex, length);
}

From source file:Main.java

public static CharSequence italic(CharSequence sequence) {
    return italic(sequence, sequence.length());
}

From source file:Main.java

public static boolean checkRegNum(CharSequence code) {
    if (TextUtils.isEmpty(code) || code.length() != 4) {
        return false;
    }//from   www  . j av a2 s .c  o  m
    return true;
}

From source file:Main.java

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

From source file:Main.java

/** 
 * we can't store a password as a string, since in Java
 * strings are immutable, and thus we can't null out and
 * guarantee the password doesn't hang around after GC;
 * CharSequence doesn't have this problem, and that's what
 * an EditText returns; So, we go from CharSequence to
 * an array of bytes; We want a byte array anyway, for crypto.
 *
 */// w  w  w  .j av  a  2 s  . com
public static char[] fromCharSeqToChars(CharSequence seq) {
    char[] ret = new char[seq.length()];
    int i;

    for (i = 0; i < seq.length(); i++) {
        ret[i] = seq.charAt(i);
    }
    return ret;
}

From source file:Main.java

/**
 * Determines if a character sequence is <code>null</code> or empty.
 * //from   www  .j a  v a 2s .c om
 * @param s
 *           The character sequence.
 * @return Returns <code>true</code> if the character sequence is
 *         <code>null</code> or empty, or <code>false</code> otherwise.
 */
private static boolean isEmpty(CharSequence cs) {
    return cs == null || cs.length() == 0;
}

From source file:Main.java

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

From source file:Main.java

/**
 * Returns true if the string is null or 0-length.
 *
 * @param str the string to be examined/*w  w  w.  j a v  a 2s .co  m*/
 *
 * @return true if str is null or zero length
 */
static boolean isEmpty(CharSequence str) {
    return str == null || str.length() == 0;
}

From source file:Main.java

public static boolean isPasswordSafe(final @NonNull CharSequence text) {
    return text.length() > 6;
}