[gutvol-p] Re: Hi, about filtering the license information.

Paulo Levi i30817 at gmail.com
Thu Dec 24 13:53:36 PST 2009


This is the code i ended up with. The context is that i don't control the
lines (so i can't use a regex - in don't know if i have all the input). I
suppose to be sure i should employ a stringbuilder to concatenate the lines
while they don't match the end of the "tag".

            boolean isMarkupStart = line.startsWith("\n***");
            if (isMarkupStart) {
                isStart = line.contains(START_TAG);
                isEnd = line.contains(END_TAG);
                inTag = isStart || isEnd;
            }
            if (isInValidText && !inTag) {
                super.insertString(offset, line, attr);
            }
            //best i can do. If the string breaks exactly at *\n**
            //or something, i suppose this wil break horribly.
            if (inTag && line.endsWith("***")) {
                isInValidText = isStart && !isEnd;
                inTag = false;
            }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/html
Size: 1039 bytes
Desc: not available
URL: <https://lists.pglaf.org/pipermail/gutvol-p/attachments/20091224/bf8c022f/attachment.txt>


More information about the gutvol-p mailing list