Java Integer Create toInt(String arr, String separator)

Here you can find the source of toInt(String arr, String separator)

Description

to Int

License

LGPL

Declaration

public static int[] toInt(String arr, String separator) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static int[] toInt(String arr, String separator) {

        if (arr == null || "".equals(arr)) {
            return new int[0];
        }/*  w  ww. jav a2 s.co m*/

        String[] array = arr.split(separator);
        int[] r = new int[array.length];

        for (int i = 0; i < array.length; i++) {
            r[i] = Integer.parseInt(array[i]);
        }

        return r;
    }
}

Related

  1. toInt(short leftShort, short rightShort)
  2. ToInt(short n1, short n2)
  3. toInt(short s0, short s1)
  4. toInt(short x, short y)
  5. toInt(short[] arr)
  6. toInt(String chars)
  7. toInt(String input, int defaultValue)
  8. toInt(String input, int offset, int length)
  9. toInt(String intValue, int defaultValue)