Java String Split by Separator splitStringToLong(String strInput, String separator)

Here you can find the source of splitStringToLong(String strInput, String separator)

Description

Split String to List of long by separator

License

Open Source License

Parameter

Parameter Description
strInput a parameter
separator a parameter

Declaration

public static List<Long> splitStringToLong(String strInput, String separator) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    /**/*from w  w  w  .j  ava  2  s .c  om*/
     * Split String to List of long by separator
     * @param strInput
     * @param separator
     * @return 
     */
    public static List<Long> splitStringToLong(String strInput, String separator) {
        List<Long> lstResult = new ArrayList<Long>();
        if (strInput != null && !strInput.isEmpty()) {
            String[] strTemp = strInput.split(separator);
            if (strTemp != null && strTemp.length > 0) {
                for (int i = 0; i < strTemp.length; i++) {
                    lstResult.add(Long.valueOf(strTemp[i]));
                }
            }
            return lstResult;
        }
        return null;
    }
}

Related

  1. splitListBySeparator(String text, String separator)
  2. splitNotRegex(String str, String separatorChars)
  3. splitSmart(String s, char separator)
  4. splitStaySeparator(String str, char token)
  5. splitString(String sInput, String sSeparator)
  6. splitStringWithBracesOnSeparator(String string, char separator)
  7. splitStructs(String str, char separator)
  8. splitToList(String s, String separator)
  9. splitValues(String concatedValues, String separator)