NumberFormatException when trying to convert String to int while using split() method
<pre><code>string = "#1x#2#3#4#5#6#";

    String array[] = string.split("#");
    for(int count=0;count&lt;=6;count++){
        // String temp = array[count];
        String temp1 = array[count].substring(0,1).trim();//here temp1="1"
        //  String temp1 = "1"; //this is possible 
        log (Integer.parseInt( temp1));// i cant convert the array which is populated by split("delimiter") why ??
    }
</code></pre>

<p>Here's the array:</p>

<pre><code>array[]=("1","2","3","4","5","6"}
</code></pre>

<p>I can convert the the String array[] into integer when i am declaring this as normal String array but when i am using split and populating the String array here in this example .</p>

<p>I am ready to explain if you can't understand too. Help me out in this?
The Error is</p>

<pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
</code></pre>

<p>My question is Integer.parseInt(string_array_populated_by_split_method[count]) is throwing Exception </p>

<p><strong>Here the return value is a string "1" i.e Integer.parseInt("1").. this "1" is generated by split() method</strong></p>

<p>Thanks in Advance.</p>
