[英]line break in notepad++
I am building a standard Filewriter in Notepad++. 我正在Notepad ++中构建标准的Filewriter。 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. 我搜索了“ Notepad ++中的换行符”,发现了很多替换和字符串输出答案(例如放入\\ n,\\ r,\\ r \\ n或\\ n),但是它们都不起作用。
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.
我希望目前我的Notepad ++的可读性更好。
What am I missing here? 我在这里想念什么? Thanks for your replies in advance.
感谢您的提前答复。
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());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.