Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 62 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. Replace \n in BufferedWriter.write()?
  2. String input = "Name: adfasd n AN: asdfasdf n";
  3. Writer textOutput = null;
  4. File file = new File("write.txt");  
  5. textOutput = new BufferedWriter(new FileWriter(file));
  6. textOutput.write( input );
  7. textOutput.close();
  8.    
  9. String text = "Line 1 \n Line2";
  10. System.out.println(text);
  11. System.out.println(text.replace("\n", "n"));
  12.    
  13. public void test() throws IOException {
  14.     BufferedWriter writer = new BufferedWriter(new FileWriter("/someDir/test.txt"));
  15.     writer.write("HellonWorld");
  16.     writer.close();
  17. }
  18.    
  19. Hello
  20. World
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top