/**
*按字节长度截取字符串
*
@param
str将要截取的字符串参数
*
@param
toCount截取的字节长度
*
@param
more字符串末尾补上的字符串
*
@return
返回截取后的字符串
*/
public
Stringsubstring(Stringstr,
int
toCount,Stringmore)
{
int
reInt
=
0
;
StringreStr
=
""
;
if
(str
==
null
)
return
""
;
char
[]tempChar
=
str.toCharArray();
for
(
int
kk
=
0
;(kk
<
tempChar.length
&&
toCount
>
reInt);kk
++
)
{
Strings1
=
str.valueOf(tempChar[kk]);
byte
[]b
=
s1.getBytes();
reInt
+=
b.length;
reStr
+=
tempChar[kk];
}
if
(toCount
==
reInt
||
(toCount
==
reInt
-
1
))
reStr
+=
more;
return
reStr;
}





















