Hi!. I'm stuck in a function which in theory, should recibe a complete string, split per line (as they have a delimiter '\n') and eliminate duplicate, triplicate or quadruplicate lines. I can not remove the repeated lines :/ Here is the function.
The goal is to keep everything in one file but without repeated lines. An interesting fact is that the lines are repeated one after another, and will not be necessary to compare all the lines with all. Thanks in advance!!
Get first line - store in previousLine variable
Write first line.
repeat for all remaining lines:
{
Get next line - store in currentLine variable.
If currentLine is not the same as previousLine, write it.
previousLine = currentLine;
}
delete original file
rename output file to same name as deleted original file.
If you have whitespace, you must either use getline() (e.g. through a "line input iterator" http://ideone.com/CPxWU or modify the character classification table to only treat '\n' as whitespace: http://ideone.com/LOYO3