Here you can find the source of splitLongUnicodeString(String message, List
public static List<String> splitLongUnicodeString(String message, List<String> result)
//package com.java2s; import java.util.List; public class Main { private static int MAX_CHAR = 160; public static List<String> splitLongUnicodeString(String message, List<String> result) { String firstTempString = null; String secondTempString = null; int indexToCut = 0; firstTempString = message.substring(0, MAX_CHAR); indexToCut = firstTempString.lastIndexOf(" "); firstTempString = firstTempString.substring(0, indexToCut); result.add(firstTempString);// w ww .j a va 2s . c om secondTempString = message.substring(indexToCut + 1, message.length()); if (secondTempString.length() <= MAX_CHAR) { result.add(secondTempString); return result; } else { return splitLongUnicodeString(secondTempString, result); } } }