JAVA工具类-StrUtils

public class StrUtils {
public static final String UTF_8 = "UTF-8"; /**
* 去掉小数字符串后面无用的零
*/
public static String replaceTheTailZero(String value){
if(StringUtils.isEmpty(value)){
return value;
}
if(value.indexOf(".") > 0){
value =value.replaceAll("0+?$", "");//去掉后面无用的零
value =value.replaceAll("[.]$", "");//如小数点后面全是零则去掉小数点
}
return value;
} /**
* UTF-8字符长度换算
*/
public static int getStrByteLen(String value) throws UnsupportedEncodingException{
if(StringUtils.isEmpty(value)){
return 0;
}
return value.getBytes(UTF_8).length;
} /**
* 验证是否为空
*/
public static boolean validationIsNull(String value) {
if (StringUtils.isEmpty(value)) {
return true;
}
if (StringUtils.trim(value).length() == 0) {
return true;
}
return false;
}
}
上一篇:一款基于jquery的手风琴图片展示效果


下一篇:10 款基于 jQuery 的切换效果插件推荐