public String skipComments(String line) {
    // We support simple block comments; ie a single pair per line
    if (!inBlockComment && line.contains("/*") && line.contains("*/")) {
      blockCommentBegin();
      String lhs = line.substring(0, line.lastIndexOf("/*"));
      if (line.contains("*/")) {
        line = lhs + line.substring(line.lastIndexOf("*/") + 2);
        blockCommentFinish();
      } else {
        line = lhs;
      }
    } else if (!inBlockComment && line.contains("/*")) {// GemStone Added
      blockCommentBegin();
    }
    if (inBlockComment) {
      if (!line.contains("*/")) {
        return null; // TODO: should this throw an exception instead?
      }
      blockCommentFinish();
      line = line.substring(line.lastIndexOf("*/") + 2);
    }
    // We also support inline comments (but only at start of line, otherwise valid
    // command options like http://www.helloworld.com will fail as per ROO-517)
    if (!inBlockComment && (line.trim().startsWith("//") || line.trim().startsWith("#"))) { // #
                                                                                            // support
                                                                                            // in
                                                                                            // ROO-1116
      line = "";
    }
    // Convert any TAB characters to whitespace (ROO-527)
    line = line.replace('\t', ' ');
    return line;
  }
Utility based on code extracted from
{@link org.springframework.shell.core.AbstractShell#executeCommand(String)}

@since GemFire 7.0
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/util/CommentSkipHelper.java