how to find the number of times a specific word appears in a book in c#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to find the number of times a specific word appears in a book in c#?

24th Jan 2017, 3:23 PM
Doaa Mohamed
Doaa Mohamed - avatar
2 Answers
+ 1
split the text by spaces, iterate over every word, check if it's your word, add 1 to a counter
24th Jan 2017, 3:50 PM
Daniel S
Daniel S - avatar
+ 1
you need a counter (int) and it depends if u want to count from a file.txt or the console using a list
26th Jan 2017, 11:09 AM
Catalin Popinciuc
Catalin Popinciuc - avatar