Go to diff to previous submission
import java.io.BufferedReader; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.io.InputStreamReader; class Bugs { /** * @param args the command line arguments */ while(true){ if(firstLine == null) return; // System.out.println(errorCode + " " + errorCode.length()); int errorCodeLength = errorCode.length(); for (int i = 0; i < lineCount; i++) { line = br.readLine(); if(line.length() >= errorCodeLength){ while(line.contains(errorCode)){ int position = line.indexOf(errorCode); line = line.substring(0, position) + line.substring(position + errorCodeLength); } } } } } }
--- c4.s725.cteam037.bugs.java.0.Bugs.java +++ c4.s1245.cteam037.bugs.java.0.Bugs.java @@ -30,6 +30,7 @@ if(line.length() >= errorCodeLength){ while(line.contains(errorCode)){ - - line = line.replaceAll(errorCode, ""); + int position = line.indexOf(errorCode); + line = line.substring(0, position) + + line.substring(position + errorCodeLength); } }