Android Utililty Methods String Length Check

List of utility methods to do String Length Check

Description

The list of methods to do String Length Check are organized into topic(s).

Method

booleancheckMinLength(final String x, final int min)
Checks string length minimum.
return !(x == null || x.length() < min);
booleanisStringWithLen(Object obj, int len)
is String With Len
if (obj == null) {
    return false;
if (obj.toString().trim().length() < len) {
    return false;
return true;
booleanisStringWithLen(String str, int len)
is String With Len
if (str == null) {
    return false;
if (str.trim().length() < len) {
    return false;
return true;
intstrlen(String str, String charset)
strlen
if ((str == null) || (str.length() == 0)) {
    return 0;
int length = 0;
try {
    length = str.getBytes(charset).length;
} catch (Exception e) {
    e.printStackTrace();
...
intstrlen(String str, String charset)
strlen
if (str == null || str.length() == 0) {
    return 0;
int length = 0;
try {
    length = str.getBytes(charset).length;
} catch (Exception e) {
    e.printStackTrace();
...
intstrLength(String str)
str Length
int valueLength = 0;
String chinese = "[\u0391-\uFFE5]";
if (!isEmpty(str)) {
    for (int i = 0; i < str.length(); i++) {
        String temp = str.substring(i, i + 1);
        if (temp.matches(chinese)) {
            valueLength += 2;
        } else {
...