Here you can find the source of strlen(String str, String charset)
public static int strlen(String str, String charset)
//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; } }