Problem splitting a string
Heya, im trying to read user information from a file.
I know need to split each line into pieces to just obtain their ssn number and password.
But im having a bit of a problem, some lines contain more than just a \t
heres the code
import java.util.regex.*;
import java.io.*;
class Person{
publicstaticvoid main(String[] args)throws IOException, NullPointerException{
BufferedReader myIn =new BufferedReader(new FileReader("persondata.txt"));
String line ="";
String[] words;
for (int a=0; a<7; a++){
line = myIn.readLine();
words = line.split ("\t");
System.out.println (words[0] +" \t " + words[1] +" \t " + words[2] +" \t " + words[3] +" \t " + words[4]);
}
}
}
Heres the text file im trying to read from
namelastnamessnSaleryPassword
BoEk650326-2781105abc123
NisseSvensson801202-122378,5aqw183
HassenKhameli790412-3423120jonas
LisaAndersson760203-343485kla12
JakobNilsson820603-444483sdlksq
EliziReveiro790923-125690lksfj
Some lines to do have more than just one " \t " betwen the words which mess it up.
Im not sure how i can solve this?
Best Regards
Message was edited by:
HolaJawn

