在文本文件中查找特定单词并将该单词存储在数组列表中

我想在文本文件中找到特定的单词并将该单词存储在列表数组中。

我不知道它是如何实现或接近的。


慕斯王
浏览 127回答 1
1回答

哆啦的时光机

一个基本的解决方案:public ArrayList getWords(String searchWord, String listOfWords){&nbsp; &nbsp; ArrayList<String> foundWords = new ArrayList<>();&nbsp; &nbsp; if (listOfWords.contains(searchWord)){&nbsp; &nbsp; &nbsp; &nbsp; foundWords.add(searchWord);&nbsp; &nbsp; }return foundWords;}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java