简体   繁体   中英

Im trying to extract specific words from txt file with an String input for java

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" ?

you can use string.Contains("er") to check if the word matches your pattern or not

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM