help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: help

  1. #1
    supa Guest

    help


    How to count the number of occurances of all the words in a text file using
    java?

  2. #2
    Simon Sellick simon.sellick Guest

    Re: help


    "supa" <supa_alwayscool@mailcity.com> wrote:
    >
    >How to count the number of occurances of all the words in a text file using
    >java?

    You could try:

    Decide what characters delimit a word and use strtok() on an input stream
    connected to the file to retrieve each word in turn. For each word, determine
    whether it is already present in an indexed list of word counts: if so, increment
    the count, otherwise add it and set the count to 1. I'll leave you to find
    a suitable class for holding the indexed set of word counts - there is a
    class perfectly suited.

    Good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center