I'm trying to make program which can write phrases into the text document, new line below previous, just in original order.
So now if equal line is not exist in text document, I add it to the document. And if equal phrase is exist, program shows it on output. But I want see not this exist (equal to inserted) phrase, but phrase below it in list order, or above depending on index of equal phrase. Question is how to get index for lines, and how to manipulate with it to get other lines through chosen index?
1. Read your file line by line to a string container. (array of strings)
2. Search your array for a word. (keep track of index in a loop)
3. use modulus (even / odd ) property to determine where you newline is inserted.
4. rewrite the string array over you current file.