Android String Length Check strlen(String str, String charset)

Here you can find the source of strlen(String str, String charset)

Description

strlen

Declaration

public static int strlen(String str, String charset) 

Method Source Code

//package com.java2s;

public class Main {

    public static int strlen(String str, String charset) {
        if (str == null || str.length() == 0) {
            return 0;
        }// w  ww  . j av  a2  s .  c om
        int length = 0;
        try {
            length = str.getBytes(charset).length;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return length;
    }
}

Related

  1. checkMinLength(final String x, final int min)
  2. isStringWithLen(Object obj, int len)
  3. isStringWithLen(String str, int len)
  4. strlen(String str, String charset)
  5. strLength(String str)