I know that
FileUtils.writeStringToFile(myfile.txt, "my string", true);
adds 'my string' to the end of myfile.txt, so it looks like
previous stringsmy string
But is there any way to use Commons IO to write a string to a new line in a file, to change the file to
previous strings
my string
Java use \n
to mark new line so try with:
FileUtils.writeStringToFile(myfile.txt, "\nmy string", true);
declare
final String newLine = System.getProperty("line.separator");
and in call, FileUtils.writeStringToFile(myfile.txt, yourVariable+newLine, true);
i use a variable , so this was more useful for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With