英文:
Im trying to extract specific words from txt file with an String input for java
问题
So far:
我扫描了一个包含诸如("monster, lobster, chopper")
的.txt
文件。
如果我使用了一个scanner
类输入//对于我的输入,我想输入"er"
,
我该如何能够打印出在.txt
文件中包含"er"
的单词?
英文:
So far:
I scanned a .txt
file which includes words such as ("monster, lobster, chopper")
If I used a scanner
class input //for my input I would like to input "er"
how would I be able to print the words in the .txt
that include "er"
?
答案1
得分: 0
你可以使用string.Contains("er")
来检查这个词是否与你的模式匹配。
英文:
you can use string.Contains("er")
to check if the word matches your pattern or not
专注分享java语言的经验与见解,让所有开发者获益!
评论