Here you can find the source of isUTF8StringLengthValid(int min, int max, String string)
Parameter | Description |
---|---|
min | a parameter |
max | a parameter |
string | a parameter |
public static boolean isUTF8StringLengthValid(int min, int max, String string)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { /**/*from www.jav a 2s .com*/ * Check the validity of the Length of a UTF8 String. * * @param min * @param max * @param string * @return boolean indicating UTF-8 String Length is valid or not. */ public static boolean isUTF8StringLengthValid(int min, int max, String string) { if (string == null) { return false; } try { byte[] bytes = string.getBytes("UTF-8"); return ((bytes.length >= min) && (bytes.length <= max)); } catch (UnsupportedEncodingException uee) { // Ignore... } return false; } }