
Untitled
By: a guest on
May 27th, 2012 | syntax:
None | size: 0.56 KB | hits: 11 | expires: Never
How to represent a TextFile as an Array
var stopwordsarr = new string[] {"stopword1", "stopword2", "stopword3", "etc.."};
static void Main(string[] args) {
var fname = args[0];
var words = File.ReadAllLines(fname);
Console.WriteLine("var stopWords = new string[] {");
for(int i = 0; i < words.Length; ++i) {
string word = words[i];
Console.Write("@"{0}"", word.Replace(""", "\""));
if(i < words.Length - 1) {
Console.Write(",");
}
Console.WriteLine();
}
Console.WriteLine("};");
}
var stopWordsArr = File.ReadAllLines(path);