* 按字節長度截取字符串
* @param str 將要截取的字符串參數
* @param toCount 截取的字節長度
* @param more 字符串末尾補上的字符串
* @return 返回截取後的字符串
*/
public String substring(String str, int toCount, String more) {
int reInt = 0;
String reStr = "";
if (str == null)
return "";
char[] tempChar = str.toCharArray();
for (int kk = 0; (kk < tempChar.length && toCount > reInt); kk++) {
String s1 = str.valueOf(tempChar[kk]);
byte[] b = s1.getBytes();
reInt += b.length;
reStr += tempChar[kk];
}
if (toCount == reInt || (toCount == reInt - 1))
reStr += more;
return reStr;
}