private static String removeComment(String line) {
        int index = line.indexOf("#");
        if (!line.contains("#") || index == 0) return line;

        int firstQuote = line.indexOf("\"");
        if (firstQuote > 0) {
            int secondQuote = line.indexOf("\"", firstQuote + 1);
            if (index > secondQuote) {
                line = line.substring(0, index);
                line = line.trim();
            }
        } else  {
            line = line.substring(0, index);
            line = line.trim();
        }

        return line;
    }
Normalizes a config definition line. Each string is normalized according to the
rules of config and definition files before they are used:
<ul>
<li>Remove trailing space.<li>
<li>Remove trailing comments, and spaces before trailing comments.</li>
<li>Remove empty lines</li>
<li>Keep comment lines</li>
</ul>
The supplied list is changed in-place

@param line a config definition line
@return a normalized config definition line
configgen/src/main/java/com/yahoo/config/codegen/NormalizedDefinition.java