Suppose a file contains something like "123456". I want to read it and insert some characters or something between '3' and '4'. Everything I try replaces whole file or append it at the end. here is my code
File i=new File(path+"names.txt");
Formatter o=new Formatter(path+"sorted_names.txt");
Scanner s=new Scanner(i);
s.useDelimiter(",");
while(s.Next()!="MyName")
{
j++;
}
o.format("%s", "Bhargab");
o.close();
it replaces whole file. I want "Bhargab" written just after "MyName".