Processing a Textfile

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Using C# and a textfile I need to do two things:

1. Read the contents of the textfile and return the number of words
contained in it.
2. Output a list of unqiue words (i.e. not duplicated) to a new textfile.
These words should appear on a new line.
eg.
hello
world

This needs to be done in C# and I am struggling to understand how to do this
using the TextReader and TextWriter.

Any help greatly appreciated.

Thanks

Kevin
 
Use the StreamReader class, you can then use the Split() method in
string to split words and store them in a hashtable (or whatever data
structure you have that preserves uniqueness). You can then write it
the hashtable out to a file.
 
Thanks for that. Could you provide a coded example as it is not something I
have used before?

Thanks

Kevin
 
<"=?Utf-8?B?S2V2aW4gSm9obnNvbg==?=" <Kevin
Thanks for that. Could you provide a coded example as it is not something I
have used before?

Which part of it? I'd suggest trying it yourself first, then posting
your attempt, and what you're having trouble with - that way you'll
learn a lot more than if someone just gives you all the code you need
to start with.
 
So have u been able to do it?

Ab.


Kevin Johnson said:
Thanks for that. Could you provide a coded example as it is not something I
have used before?

Thanks

Kevin
 
Back
Top