This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

searching for specific data in a text file

 
Rodney Ibanez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help. I don't know where I am wrong with my code. I would like to be able to search a certain word in my text file either using scanner or buffered reader. using scanner to get the input from the user to search for the word and using buffered reader to actually look for the word in my text file would be better. If there's no way to do that, then anything will do just fine. Thank you.
Here is my complete code.
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this question doesn't have anything to do with any of Swing / AWT / SWT I've moved it here.

You might find the classes in the java.util.regex package usefule for your task. Unless of course this is an assignment that requires you to reinvent that particular wheel.
 
Rodney Ibanez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Since this question doesn't have anything to do with any of Swing / AWT / SWT I've moved it here.

You might find the classes in the java.util.regex package usefule for your task. Unless of course this is an assignment that requires you to reinvent that particular wheel.


Thanks.. I've learned a lot from the regex package!I came up with a solution.. I changed the .equalsto() with .matches(regex) now I have a different issue.. How can I make my program stop searching as soon as it finds a match? they say i don't need the goto anymore for a really clean coding since "goto" is only used for assembly. here is my new code..

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic