我想知道 ArrayList 中是否有一种方法可以搜索以查看记录是否包含某些字符,如果是,则抓取整个句子并放入字符串中。例如:
list[0] = "C:\Test3\One_Title_Here.pdf";
list[1] = "D:\Two_Here.pdf";
list[2] = "C:\Test\Hmmm_Joke.pdf";
list[3] = "C:\Test2\Testing.pdf";
寻找:"Hmmm_Joke.pdf"
想要得到:"C:\Test\Hmmm_Joke.pdf"
并放入Remove()
protected void RemoveOther(ArrayList list, string Field)
{
string removeStr;
-- Put code in here to search for part of a string which is Field --
-- Grab that string here and put it into a new variable --
list.Contains();
list.Remove(removeStr);
}
希望这是有道理的。谢谢。