I would like to know, that if I am having a single line string, then how to count the frequency of a particular word in that string, using simple java code?!
Thanks in advance..
What I am looking for is a sample logical code in java which is used to search a particular word in a sentence. I am building one spam filter, which needs to read the line and then classify it.
StringUtils
from commons-lang has:
StringUtils.countMatches(string, searchedFor);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With