This is my code how do I convert the Object of Basewords into a string?
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
NetSpell.SpellChecker.Dictionary.WordDictionary oDict = new NetSpell.SpellChecker.Dictionary.WordDictionary();
oDict.DictionaryFile = "en-US.dic";
oDict.Initialize();
NetSpell.SpellChecker.Spelling oSpell = new NetSpell.SpellChecker.Spelling(); int Anumber = 0; int CheckforAs(string word) { int numberofAs = 0; for (int i = 0; i < word.Length; i++) { if(word[i] == 'a' || word[i] == 'A') { numberofAs += 1; } } return numberofAs; } string Aword;
for(int i = 0; i < oDict.BaseWords.Count; i++ ) { if(CheckforAs(oDict.BaseWords[i]) > Anumber) { Anumber = CheckforAs(oDict.BaseWords[i]); Aword = oDict.BaseWords[i]; } }
Console.WriteLine(Aword); Console.ReadLine(); } } }
NetSpell.SpellChecker.Spelling oSpell = new NetSpell.SpellChecker.Spelling(); int Anumber = 0; int CheckforAs(string word) { int numberofAs = 0; for (int i = 0; i < word.Length; i++) { if(word[i] == 'a' || word[i] == 'A') { numberofAs += 1; } } return numberofAs; } string Aword;
for(int i = 0; i < oDict.BaseWords.Count; i++ ) { if(CheckforAs(oDict.BaseWords[i]) > Anumber) { Anumber = CheckforAs(oDict.BaseWords[i]); Aword = oDict.BaseWords[i]; } }
Console.WriteLine(Aword); Console.ReadLine(); } } }
0 Replies