public static String SubStrByByte(String str,int startIndex,int length) { StringBuilder sb = new StringBuilder(); //已截取 字符串 int len = 0; //中文字符数目 int cnCount = 0; String[] arr = new String[str.length()]; arr = str.split(""); for(int i = startIndex + 1; i< arr.length; i++) { if(arr[i].getBytes().length == 1) { len = len + 1; } else if(arr[i].getBytes().length == 2) { cnCount ++; len = len + 2; } sb.append(arr[i]); if(len >= length) break; } if(len >= length) return sb.toString().substring(0,length - cnCount); else return sb.toString(); } public static void main(String[] args) { String str = "あ23我我2我as"; String byteStr = StringUtil.SubStrByByte(str,2,8); System.out.println(byteStr); } 输出结果:3我我2我