private String stringFilter()

in maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java [774:808]


    private String stringFilter(String line) {
        if (line == null || line.equals("")) {
            return "";
        }
        StringBuilder buf = new StringBuilder();
        if (line.indexOf('"') <= -1) {
            return keywordFilter(line);
        }
        int start = 0;
        int startStringIndex = -1;
        int endStringIndex = -1;
        int tempIndex;
        // Keep moving through String characters until we want to stop...
        while ((tempIndex = line.indexOf('"')) > -1) {
            // We found the beginning of a string
            if (startStringIndex == -1) {
                startStringIndex = 0;
                buf.append(stringFilter(line.substring(start, tempIndex)));
                buf.append(STRING_START).append('"');
                line = line.substring(tempIndex + 1);
            }
            // Must be at the end
            else {
                startStringIndex = -1;
                endStringIndex = tempIndex;
                buf.append(line, 0, endStringIndex + 1);
                buf.append(STRING_END);
                line = line.substring(endStringIndex + 1);
            }
        }

        buf.append(keywordFilter(line));

        return buf.toString();
    }