Java String Split splitLongUnicodeString(String message, List result)

Here you can find the source of splitLongUnicodeString(String message, List result)

Description

split Long Unicode String

License

Open Source License

Declaration

public static List<String> splitLongUnicodeString(String message,
            List<String> result) 

Method Source Code

//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);
        }
    }
}

Related

  1. splitLargeStringIfNecessary(String s)
  2. splitList(String list)
  3. splitList(String string)
  4. splitLists(String s)
  5. splitListToParts(final List list, final int times)
  6. splitMacros(String s)
  7. splitManagedBean(String el)
  8. splitMultiMessageString( String multiMessageString, String messageSplitter)
  9. splitName(String name)