日期:2014-05-20 浏览次数:20783 次
public static void main(String[] args) { try { String line = null; StringBuilder builder = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while ((line = br.readLine()) != null) { if (line.equalsIgnoreCase("EOF")){ break; } else{ builder.append(line); } } String ss = builder.toString(); System.out.println(ss.replaceAll("you", "we")); } catch (Exception e) { e.printStackTrace(); } }
------解决方案--------------------
使用别的结束符,只要可以标识结束就可以。