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 boolean isNullOrEmpty(CharSequence s) {
    return s == null || s.length() <= 0;
}

From source file:Main.java

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

From source file:Main.java

private static char getShortyType(CharSequence type) {
    if (type.length() > 1) {
        return 'L';
    }//from  w w w .  j  a  v  a2s  . c o m
    return type.charAt(0);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static boolean stringIsEmpty(final CharSequence cs) {
    return cs == null || cs.length() == 0;
}

From source file:Main.java

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

From source file:Main.java

public static String buildIdentificationNumberWithDecimalSeparator(CharSequence number) {
    if (number.length() == 0) {
        return number.toString();
    }// ww w  .  j a  v  a2  s . c  om
    try {
        Long value = Long.valueOf(number.toString());
        Locale.setDefault(Locale.GERMAN);
        return String.format("%,d", value);
    } catch (NumberFormatException e) {
        return "";
    }
}

From source file:Main.java

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

From source file:Main.java

private static int getEndIndex(CharSequence input) {
    int index = input.length() - 1;
    while (Character.isWhitespace(input.charAt(index))) {
        --index;/*  w w w  .  j  ava2s . c o  m*/
        if (index < 0) {
            break;
        }
    }
    return index;
}