我正在尝试将此代码上的printwriter格式化为仅打印小写并删除所有非字母字符。
干杯
import java.io.*;
public class TextFile {
public static void main (String[] args) throws IOException {
File file1 = new File("PG.txt");
File file2 = new File("newfile.txt");
BufferedReader in = (new BufferedReader(new FileReader(file1)));
PrintWriter out = (new PrintWriter(new FileWriter(file2)));
int ch;
while ((ch = in.read()) != -1){
out.write(ch);
}
in.close();
out.close();
}
}