I need to read lines in a file word by word and spit it back out with something appended to it. I know I can use Scanner to read lines, but there is not Scanner method to parse strings from the line. Is it possible to Scan lines in a loop then parse the words from the line in another loop? What's the best method to implement this?
Well definitely yes, it is a standard cs exercise; but please give some idea of what the string looks like you want to parse and what splitting chars may be available to split the string on and so on. It is all very straight forward, just provide some more details so that we do not begin guessing and give time-wasting blunders to your effort.
"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
There are multiple words in the file , some on different lines. For instance The only delimiter would be space between each word. How would I find out if i'm at the end of a line and how do i write it into another file exactly like that , but with the ability to append things in between each word if i want.
Joined: Sep 17, 2006
Well, I patched together the following in the hopes of pulling some more program specifications. A wish list would do just fine, even random thoughts or a plain:
"I have not thought about that."
You would really be suprised how many development paths this program can take, and in fact I will probably use the above short snippet in my program.
Use StringBuffer or StringBuilder to insert words into a line of text. readline returns a String, which will not let you insert characters in it.