String 字符串递归截取字节字符串

 

public static String idgui(String s,int num)throws Exception{
int changdu = s.getBytes("UTF-8").length;
if(changdu > num){
s = s.substring(0, s.length() - 1);
s = idgui(s,num);
}
return s;
}

posted @ 2016-12-19 11:52  myJoan  阅读(379)  评论(0编辑  收藏  举报