📜  filterreader 将字符串转换为大写 java 代码示例

📅  最后修改于: 2022-03-11 14:52:11.302000             🧑  作者: Mango

代码示例1
import java.io.*;

public class TextFile {
    public static void main (String[] args) throws IOException {
        File file1 = new File("intext.txt");
        File file2 = new File("outtext.txt"); 
        char CharCounter = 0;       
        BufferedReader in = (new BufferedReader(newFileReader(file1)));
        PrintWriter out = (new PrintWriter(new FileWriter(file2)));
        int ch;
        while ((ch = in.read()) != -1){
            if (Character.isUpperCase(ch)){
                Character.toLowerCase(ch);

            }
            out.write(ch);
        }
        in.close();
        out.close();
    }       
}