Reputation: 9745
If I have a string like :
10.120.230.172 DOM1/HKJ - 2010-11-04 08:05:30 - - 10.120.12.16 - 80 410
I can use split to sepparate each item like :
String[] temp;
String delimiter = "//t";
temp = input.split(delimiter);
Normally I would be able to get :
String IpAddress = temp[0];
String user = temp[1];
etc ....
I get a java.lang.ArrayIndexOutOfBoundsException
What am I doing wrong guys?
Upvotes: 0
Views: 211
Reputation: 346307
Your delimiter is wrong (assuming you want to split on tabs). This should work:
String delimiter = "\t";
Upvotes: 1
Reputation: 403501
Your delimiter should be \t
, not //t
The former is a single tab character, the latter is a string containing 2 forward slashes and the character t
Upvotes: 1