Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Java 中,我正在为要上传到其他系统的批处理文件创建一个文本文件。
当我在行尾写入该文件时,我正在使用\n它来启动换行符。在开始新行时,它会在行尾向文件中添加空间。
\n
如何克服这个问题?
您没有显示代码或描述空间。可能是 LF 之前的 CR 字符,具体取决于您在做什么、平台和配置。
从第二行开始,在每行之前而不是之后打印换行符。