| try { FileReader fr = new FileReader(f); BufferedReader br = new BufferedReader(fr); String line = new String(""); line = br.readLine(); int count = 0; int location = 0; while(line != null) { while(pinyin.indexOf(line.charAt(0)) != -1) { location = pinyin.indexOf(line.charAt(0)); pinyin = pinyin.substring(0, location) + line.substring(1, 2) + pinyin.substring(location + 1, pinyin.length()); } line = br.readLine(); System.out.print("\b\b\b\b\b\b" + count++); } fr.close(); br.close(); } catch(Exception e) { // System.err.println(e); } return pinyin; } public static void main(String[] args) { String paths = new String("D:\\Work\\2004.10.8\\test system\\test01\\word\\"); String savepaths = new String ("D:\\Work\\2004.10.8\\test system\\test01\\html\\"); String path = new String("D:\\test\\file\\pinyin.txt"); change(path, paths, savepaths); } }
|