You are on page 1of 1

import org.apache.commons.lang.

StringUtils;
public class WordCountExample
{
public static void main(String[] args)
{
String string = "How r you?R you fine?Where are you going?";
System.out.println(StringUtils.countMatches(string,"you")+ " occurrences
of the word 'you' in '" + string +
"' is found.");
}
}

You might also like