java - Getting ArrayIndexOutOfBound on String split -


i splitting string in string array.

string = "somestring1, somestring2 00000-0000";     string[] b = a.split("(\\, )|(\\ )|(\\-)");     

and assigning array values

string c = b[0];     string d = b[1];    string e = b[2];    string f = b[3];     

which giving exception arrayindexoutofbound array index out of range: 4


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -