If only I knew how to program in Delphi7
If I knew any programming or scripting languages that well, I would've done it myself, but sadly, I'm still only learning them, and the most complicated programs I can write are either display colored lines on the screen, or calculate something in the console window. Manipulating strings and files, and working with dense arrays are still beyond my abilities at this time. I COULD write the pseudo-code for the script/program, but I can't program it myself.
I think a sequential algorithm would work:
Code:
OPEN file
X=0
IF search string "-->" returns result
THEN:
move pointer to location
go down one line
ELSE:
msg: "Wrong file"
END PROGRAM
END IF
REPEAT UNTIL X=1
IF search string "-->" returns result
THEN:
move pointer to location
go down one line
record location to variable SP
IF search string "-->" returns result
THEN:
move pointer to location
go down one line
REPEAT UNTIL encountering an empty line
record actual line to array L
DELETE actual line
END
move pointer to location SP
REPEAT UNTIL encountering an empty record in array L
insert respective line from array L to this location
new line
END
ELSE:
END PROGRAM
END IF
ELSE:
X=1
END IF
END
SAVE file
CLOSE file
msg: "finished"
END PROGRAM
It's just an amateur sketch, but it might work...
