1、如 Tools.split(message, 70);意为以70个字符作为长度,进行分割 /*' ============================================ ' 按指定长度分割字符串,通常用于短信 ' ' ============================================*/ public static String[] split(String msg, int num) { int len = msg.length(); if (len <= num) return new String[] {msg}; int count = len / (num - 1); count += len > (num - 1) * count ? 1 : 0; //这里应该值得注意 String[] result = new String[count]; int pos = 0; int splitLen = num-1; for (int i = 0; i < count; i++) { if (i == count - 1) splitLen = len - pos; result[i] = msg.substring(pos, pos+ splitLen); pos += splitLen; } return result; } 2、按字符分隔字符串为数组 //创建号码数组 public String[] buildePhoneAry(String phone) { String phoneAry[]; if (phone.indexOf(";") > -1) { phoneAry = phone.split(";"); } else { phoneAry = new String[1]; phoneAry[0] = phone; } return phoneAry; }