I would like to write an application, in java, that allows me to open a file (txt) and using the users input, search for all instances of a particular word or string.
As there are probably more experienced programmers here, i would like some advice about how to go about creating such a tool. How would you go about creating a basic text search tool?
I have been playing around with some java classes such as File, FileOutputStream, FileInputStream, InputStreamReader, OutputStreamReader, FileReader, StreamTokenizer and would like to know the optimal way to open and search a file using java?
Thanks for any input you may have,
Des.
解决方案
Using a File with a Scanner, and a StringBuilder should give you a good start into that topic.