Here you can find the source of getUTF8StringLength(String string)
Parameter | Description |
---|---|
string | a parameter |
public static int getUTF8StringLength(String string)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { /**//from www .ja va 2s . c o m * Get length of UTF8 String Length * * @param string * @return int of UTF-8 String Length. */ public static int getUTF8StringLength(String string) { if (string == null) { return 0; } try { return string.getBytes("UTF-8").length; } catch (UnsupportedEncodingException uee) { // Ignore... } return 0; } }