Android String to Int Convert getIntegerArrayList(String strInput)

Here you can find the source of getIntegerArrayList(String strInput)

Description

get Integer Array List

Declaration

public static ArrayList<Integer> getIntegerArrayList(String strInput) 

Method Source Code

//package com.java2s;
import java.util.ArrayList;

public class Main {
    public static ArrayList<Integer> getIntegerArrayList(String strInput) {
        ArrayList<Integer> ret = new ArrayList<Integer>();
        String[] shareIDs = strInput.split(",");
        if (null != shareIDs && shareIDs.length > 0) {
            for (int i = 0; i < shareIDs.length; i++) {
                try {
                    ret.add(Integer.valueOf(shareIDs[i]));
                } catch (Exception e) {
                    e.printStackTrace();
                }/*from w w  w.j av a2  s .co  m*/
            }
        }
        return ret;
    }
}

Related

  1. tryParse(String value, int defaultValue)
  2. tryParse(String value, String defaultValue)
  3. parseInt(String str)
  4. parseInt(String arg, int defaultValue)
  5. stringToIntArray(String arrString, String separator)
  6. validInt(CharSequence integer)
  7. parseIntOrZero(CharSequence charSequence)
  8. parseInt(String string, int defValue)
  9. convertStringToInt(String str)