Bob
Bob

Reputation: 11

line break in notepad++

I am building a standard Filewriter in Notepad++. For readability I want linebreaks in the text I'm writing to my file:

    import java.io.*;

class CreateAFile {
    public static void main (String[]args){
        try{
            FileWriter writer = new FileWriter("MyText.txt");
            writer.write("This is de first part of my line                          
            and here the second part");
            writer.close();

            }catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}

I searched for "line breaks in Notepad++" and found a lot of replacing and String output answers (like putting in the \n, \r, \r\n or \n), but none of them works.

The output in the file doesn't concern me at the moment (so one line, or more lines). I want the readability in my Notepad++ to be better at the moment.

What am I missing here? Thanks for your replies in advance.

Upvotes: 0

Views: 365

Answers (1)

TEXHIK
TEXHIK

Reputation: 1398

writer.write("This is de first part of my line"                             
            + "and here the second part"
            + "one more part");

or for faster work:

   writer.write(new StringBuilder("This is de first part of my line")
                .append("and here the second part")
                .append("one more").toString()); 

Upvotes: 1

Related Questions