• Post Reply Bookmark Topic Watch Topic
  • New Topic

Counting specific word using tokenizer  RSS feed

 
Norman Neaderhiser
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been working on a program to recognize and count the number of times a particular word occurs in a string entered by a user. I can capture the input and with the tokenizer am able to parse it. I cannot figure how to get a count of a particular word ( such as "to"). Please help! Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the ways.
if "To" is to match "to", use equalsIgnoreCase()
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!