Count the number of times a string occurs in a document

I need to count the number of times a string occurs in a notepad, coul

Page 1 of 1

2 Replies - 5858 Views - Last Post: 28 April 2008 - 10:15 AM Rate Topic: -----

#1 jdileepreddy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 28-April 08

Count the number of times a string occurs in a document

Posted 28 April 2008 - 01:13 AM

I need to count the number of times a string occurs in a notepad, could some ome help me.
Is This A Good Question/Topic? 0
  • +

Replies To: Count the number of times a string occurs in a document

#2 zakary  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 427
  • Joined: 15-February 05

Re: Count the number of times a string occurs in a document

Posted 28 April 2008 - 05:01 AM

read each line of the file add use string.Contains("your string"); and if it does add 1 to a counter

This post has been edited by zakary: 28 April 2008 - 06:51 AM

Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Count the number of times a string occurs in a document

Posted 28 April 2008 - 10:15 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1