问题:把aaa.txt文件指定内容替换后输入到bbb.txt文件中
aaa.txt文件内容:你好,我叫{name},我今天在{type},今天赚了{money}。
public static void main(String[] args) { BufferedReader bfr = null;//字符输入流 InputStreamReader isr = null;//输入文件包装指定字符格式 BufferedWriter bfw = null; OutputStreamWriter osw = null; try { // isr = new InputStreamReader( new FileInputStream("D:/aaa.txt"),"UTF-8"); bfr = new BufferedReader(isr); StringBuffer sf = new StringBuffer(); String li = null; while((li = bfr.readLine())!=null){ sf.append(li); } System.out.println("读取到了:"+sf); String demo = sf.toString(); //使用replace方法进行字符串替换 demo = demo.replace("{name}","韫钰"); demo