Ya right.complete code i din't post.it was appending to file but now i changed it.used replace().
--- Update ---
Yes yes.So i din use replace() inside loop.
Type: Posts; User: shenaz
Ya right.complete code i din't post.it was appending to file but now i changed it.used replace().
--- Update ---
Yes yes.So i din use replace() inside loop.
Thank you:)
--- Update ---
File contains algorithm.
No problem.I will mark it as solved.
--- Update ---
I deleted writing newtxt to file.Instead after for loop i used s.replace() for replacing old contents with new.And then at once i wrote...
b.write(s.toString) i used for writing to file. And then b.write(newtxt) for replacing.
--- Update ---
--- Update ---
Thank you.As you told newtxt is not needed.But when i use replace()...
The code i posted is partial.I din post the code of main function where am reading from one file.I stored the read contents in an array and passed it to a function.I have posted only that function.
I am writing contents of array to a file.Array has "integer" "a" "b".
The output of the code am getting is
integer a b int.
But i want to replace integer with int in output file.
I want to replace "integer" with "int" in a file.Following is the code i have written,but its working.Pls let me know my mistake.
public static void declare(String[] array) throws IOException {...