So I have absolutely no idea why this is happening, hopefully someone can help me out. I'm a novice programmer, and lately I've noticed that whenever i use String.split() with "" as a delimiter, the first index will be null and the second index will contain the first element, and so on. Here's an example of some output i've been seeing:
public class wtf { public static void main(String[] args) { String mystring = "hello"; String[] myarray = mystring.split(""); for(int i=0; i<myarray.length;i++) System.out.println(i + ": "+ myarray[i]); } }
OUTPUT:
0:
1: h
2: e
3: l
4: l
5: o