how to get number of <tr> tags from an html formatted string

helloI am trying to get the number of <tr> tags from an html formatted string with a StringTokenizer by having "\n\r" just before <tr> tag in a string but I can't.Is there an other way I can get the number of <tr>Thank you in advance
[280 byte] By [nickgika] at [2007-11-27 6:12:57]
# 1

String html = "<table><tr><td>foo</td></tr><tr><td>foo</td></tr></table>";

int counter = 0;

int index = -1;

while ((index = html.indexOf("<tr>", index + 1)) != -1) {

counter++;

}

System.out.println(counter);

dwga at 2007-7-12 17:20:41 > top of Java-index,Desktop,Core GUI APIs...