TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Adam Rayborn
NA
6
4.7k
C# Question
Dec 7 2008 12:45 PM
Well,
Here is what I need to do:
I need to split the text from a .txt file into a list of the words in the file (which I have done) I then need to count each word and list them so that there are no repeating words in the list ( each word appears only one with a number next to it representing how many times it occurs). I am assuming I can use a hashtable for this but don't know where to begin.
The next thing I need to do is, perform an http request and find the top 5 google searched for the 3 words that appear the most and display the results.
Here is what i have so far:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections;
namespace ConsoleApplication2
{
class SplitTextFile
{
static void Main(string[] args)
{
FileStream file = new FileStream("input.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader sr = new StreamReader(file);
string s = sr.ReadToEnd();
sr.Close();
file.Close();
char[] delim = { ' ', '\t', '\r', '\n' };
string[] words = s.Split(delim);
foreach (string word in words)
{
Console.WriteLine(word);
}
Console.ReadLine();
}
}
}
Reply
Answers (
1
)
Custom Download manager
to store a text into a binary format in database..