我的代码有问题,我需要一个函数来检查文件中是否有我要查找的单词,如果有则返回 true,如果失败则返回 false。
public void MyFunction(){
String theWord = "Im very handsome";
File theFile = new File("/home/rams/Desktop/tes.txt");
if(CheckWord(theWord, theFile)){
// so I will continue my coding, while I stuck :-(
}
}
public void CheckWord(String theWord, File theFile){
// what the code to search a word, which the word is variable theWord, the file is variable theFile
// return true if in file there a word
// return false if in file there not a word
// thanks my brother
}
感谢提前。