Java Integer Create toIntArr(String s, String split)

Here you can find the source of toIntArr(String s, String split)

Description

to Int Arr

License

Open Source License

Declaration

public static int[] toIntArr(String s, String split) 

Method Source Code

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

public class Main {
    public static int[] toIntArr(String s, String split) {
        String[] intStr = s.split(split);
        int[] res = new int[intStr.length];
        for (int i = 0; i < intStr.length; ++i) {
            res[i] = toInt(intStr[i]);//from   w  w w  .  j  a v  a2  s  .c o m
        }
        return res;
    }

    public static int toInt(String str) {
        return checkStr(str) ? Integer.parseInt(str) : 0;
    }

    private static boolean checkStr(String str) {
        boolean bool = true;
        if (str == null || "".equals(str.trim()))
            bool = false;
        return bool;
    }
}

Related

  1. toInt32(int[] data, int startIndex)
  2. toInt32(long x)
  3. toInt32(Object prmIntObject)
  4. toInt4Trim(String value, int _default)
  5. toIntA(byte[] data)
  6. toIntArray(boolean[] array)
  7. toIntArray(boolean[] selectedValues)
  8. toIntArray(byte[] byteArray)
  9. toIntArray(byte[] bytes)