public static String substring(String orignal,int count){
if(orignal!=null && !"".equals(orignal))
{
if(count>1&& count<orignal.getBytes().length)
{
StringBuffer sb=new StringBuffer();
char c;
for(int i=0;i<count;i++)
{
c=orignal.charAt(i);
sb.append(c);
if(qiuhe.ischinese(c))
{
--count;
}
}
return sb.toString();
}
}
return orignal;
} |