This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes searching for specific data in a text file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "searching for specific data in a text file" Watch "searching for specific data in a text file" New topic
Author

searching for specific data in a text file

Rodney Ibanez
Greenhorn

Joined: Aug 30, 2012
Posts: 17
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

Joined: May 03, 2008
Posts: 4164
    
    3

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.


luck, db
There are no new questions, but there may be new answers.
Rodney Ibanez
Greenhorn

Joined: Aug 30, 2012
Posts: 17
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..

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: searching for specific data in a text file
 
Similar Threads
Java operator
unable to exit program..
Numberformat exception
deleting record
getting no such element exception