What is the fastest way to check if a file contains a certain string or number?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Have a look at the
Scannerclass, that ships with JDK (See official documentation). You will be able to skip certain parts of input (in this case – text file) and match against regular expression of your desire. I’m not sure if this is the most efficient way, but sure enough – it’s pretty simple. You might also take a look at this example, which will help you get started.