java - Writing new line notepad -


simply trying move new line after printing each element inside of notepad. searching has yielded uses of \r\n, doesn't seem work either.

for(string element : misspelledwords)                 {                     writer.write(element + "\n");                 } 

try this

bufferedwriter writer = new bufferedwriter(new filewriter("result.txt"));            (string element : misspelledwords) {         writer.write(element);         writer.newline();     } 

adding line separator @ end (like "\n") should work on os,but on safer side should use system.getproperty("line.separator")


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -