我有某些单词的 ArrayList :
ArrayList<String> words = new ArrayList<String>();
words.add("this");
words.add("that");
我有 EditText :
EditText name = (EditText) findViewById(userName);
现在我想检查 arrayList 的单词是否在 name(EditText) 中可用:
Boolean WordsAvailable;
WordsAvailable = checkWords(name.getText().toString());
现在我想创建函数来检查 arrayList 的单词在 EditText 中是否可用,如下所示:
public Boolean checkWords(String checkString)
{
for(int i=0;i<words.size();i++)
{
// Here i want to check that whether words of arrayList are available in EditText
If ( word is available )
{
return YES;
}
}
return NO;
}
我如何检查这种情况?