Java String to List stringToIntegerList(String input)

Here you can find the source of stringToIntegerList(String input)

Description

string To Integer List

License

Open Source License

Declaration

public static List<Integer> stringToIntegerList(String input) 

Method Source Code

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

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

public class Main {
    public static List<Integer> stringToIntegerList(String input) {
        List<Integer> ret = new ArrayList<Integer>();
        String prepared = input.replaceAll(" ", "");
        for (String s : prepared.split(",")) {
            ret.add(Integer.valueOf(s));
        }//from  w  w w  .  ja v  a 2  s.  c om
        return ret;
    }
}

Related

  1. convertToList(String vars)
  2. convertToList(String[] array)
  3. stringsToList(final String[] src)
  4. stringToArrayList(String idString)
  5. stringToBooleanList(final String str, final boolean[] listData)
  6. stringToItems(List fontsList, boolean useSeparator)
  7. stringToList(final String string)
  8. stringToList(String content)
  9. stringToList(String content, String splitter)