My contents of text file looks something like this
Synonyms of Fluster:
*panic
*perturb
*disconcert
*confuse ......
Now i wish to replace the * with numbers.Something like this.
output
Synonyms of Fluster:
1)panic
2)perturb
3)disconcert
4)confuse ......
Edit:
Integer count = 1;
File input = new File("C:\\Sample.txt");
File output = new File("C:\\output.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(input)));
Writer writer =new FileWriter(output);
while((line=reader.readLine())!=null)
{
if(line.contains("*"))
{
line.replace("*",count.toString() );
writer.write(line);
count++;
}
else
{
writer.write(line);
}
}
This is what i had tried before posting question here..But this doesn't seem to work. Now can somebody help me out..?