code: public static String stripSingleLineComments(String text) {
          if (text == null) {
              return null;
          }
  
          try {
              StringBuffer output = new StringBuffer();
  
              // First we strip multi line comments. I think this is important:
              BufferedReader in = new BufferedReader(new StringReader(text));
              while (true) {
                  String line = in.readLine();
                  if (line == null) {
                      break;
                  }
  
                  int cstart = line.indexOf(COMMENT_SINGLELINE_START);
                  if (cstart >= 0) {
                      line = line.substring(0, cstart);
                  }
  
                  output.append(line);
                  output.append('\n');
              }
  
              return output.toString();
          } catch (IOException e) {
              throw new IllegalArgumentException(e);
          }
      }
docs: Remove all the single-line comments from a block of text
  @param text The text to remove single-line comments from
  @return The single-line comment free text