Hi there,
I tried to to delete sorted number in each rows by reading a text file and write it to another file with a new format: such as
readfile1.text contains
1, thoman
2, tom
3, jess87
4, kelly
and so on.. I came up with this code and I don't know what's wrong with it.
I would like to remove those number and common and get like this:
thoman
tom
jess87
kelly
Here is my code:
public class test {
public static void main (String args[])
{
Writer writeOut = null;
FileInputStream in;
//FileinStream out;
try
{
in = new FileInputStream ("readfile1.txt");
DataInputStream data =new DataInputStream(in);
File file = new File("writefile1.txt");
int counts=0;
while(in.hasNext())
{
String s1 = in.nextLine();
String strs = s1.replaceAll(args[0], "", counts);
writeOut.write(strs);
counts++;
}
in.close();
writeOut.close();
}
}
}