Hi to all.
I want to find a specific string between lines to remove it, I'm usign readLine() to read a text with TextStream.
for example:
while(!text.atEnd()){
vectorData[ii] = text.readLine();
...
ii++;
}
QTextStream text(&file);
while(!text.atEnd()){
vectorData[ii] = text.readLine();
...
ii++;
}
To copy to clipboard, switch view to plain text mode
the read is something like:
Banana
Kiwi
Apple
Banana
Banana
Apple
Mango
Apple
Mango
so, I want to remove the Apple line just after the Banana line.
Banana
Kiwi
Apple
Banana
Banana
Apple <--- This one
Mango
Apple
Mango
First I need to locate the specific line, I tried:
if(vectorData[ii].contains("Banana\0Apple")) // Do something
if(vectorData[ii].contains("Banana\0Apple")) // Do something
To copy to clipboard, switch view to plain text mode
but didn't work.
"Banana\nApple"
"Banana\nApple"
To copy to clipboard, switch view to plain text mode
and
"Banana\n\rApple"
"Banana\n\rApple"
To copy to clipboard, switch view to plain text mode
neither. I can't use readAll() because the rest of the code breaks down. Must be taken into account every time I read the text, all the lines are in different position (the textfile is randomly modified). Thanks, I'm super newbie.
Bookmarks