因此,我正在研究一個程序,我想搜索某個單詞,但我並不十分確定如何設置搜索功能。這正是我試圖使用的,但它所做的只是輸出我輸入的任何內容。Arraylist搜索
static void searchWords(ArrayList arlWords)
{
string strInput;
Console.Write("Search a Word: ");
strInput = Console.ReadLine();
arlWords.IndexOf(strInput, 0);
Console.WriteLine("{0}", strInput);
}
對於某個單詞,「*」的含義是什麼意思:您計劃在之後計劃如何處理它? –
它只是搜索我已經放入的單詞,並告訴我,如果我有它或不是 –
因爲您的方法需要在列表中,您可以開始編寫代碼以找到該單詞在該「列表」 – starcorn