On 1/3/07, Walter Underwood <[EMAIL PROTECTED]> wrote:
On 1/3/07 9:33 PM, "Yonik Seeley" <[EMAIL PROTECTED]> wrote:
> On 1/3/07, Walter Underwood <[EMAIL PROTECTED]> wrote:
>> We tried several APIs and decided that the best was an array of
>> String with the odd elements containing the strings that needed
>> highlighting.
>
> Good idea... the only thing I could think of was an array of start/end
> offsets into the string, which is harder to read and probably harder
> to deal with.
Yep. The client code for the even/odd List is really simple.
Something like this:
for (int i=0; i<list.size(); i++) {
if (i%2 == 1) sb.append("<b>");
sb.append(handyXmlQuotingMethod(list.get(i)));
if (i%2 == 1) sb.append("</b>");
}
We wouldn't even have to complicate the API -> just trigger this
functionality based on hl.formatter. hl.formatter=interleave?
-Mike