Autor Beitrag
manfred07
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 56



BeitragVerfasst: Mo 04.09.06 15:16 
Hi Leute,

gibt es eine Möglichkeit aus einer Textdatei alle doppelten Zeilen zulöschen.
Also das man die Datei in ein Memo einliest und das gleich alle doppelten Zeilen
gleich gelöscht werden.

Beispiel

Zeile Code 11
Zeile Code 12
Zeile Code 13
Zeile Code 11 <= löschen
Zeile Code 14


Gruß Manfred
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Mo 04.09.06 15:22 
Schau dir mal die property Duplicates von TStringlist an.
blaueled
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 133

Win XP
D5
BeitragVerfasst: Mo 04.09.06 15:22 
Klar,

damit die Geschindigkeit nicht zu schlecht wird, solltest du deine Liste zuerst sortieren, und dann gucken, ob 2 gleich hintereinander sind

oder du sortirst nicht, dann musst du einfach einen Wert mit allen anderen Vergleichen.

Arne
manfred07 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 56



BeitragVerfasst: Mo 04.09.06 18:02 
Danke schön für die schnellen Antworten.
Mit dem Duplicates in TStringlist ist zwar eine Möglichkeit, aber da muß man
erst die Stringlist sortieren. Das mit dem Beispiel was ich vorher geschrieben
hatte kann auch so aus sehen.

Zeile Code 16
Zeile Code 12
Zeile Code 11
Zeile Code 15
Zeile Code 10
Zeile Code 11 <= löschen
Zeile Code 03

Ich wollte aber jetzt nicht die Datei sortieren und verändern.
Die Reihenfolge sollte schon bleiben.

Wie überprüfe ich den jede Zeile mit den anderen und wenn eine nachfolgende Zeile gleich ist
das die gelöscht wird?
Kann mir danoch einer weiter helfen....vieleicht ein kleinen Code????

Gruß Manfred
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 04.09.06 18:10 
Moin!

user profile iconmanfred07 hat folgendes geschrieben:
Kann mir danoch einer weiter helfen....vieleicht ein kleinen Code????
Guckst du. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
manfred07 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 56



BeitragVerfasst: Mi 06.09.06 11:04 
Hi Narses,

Danke schön für den Link.

Gruß Manfred
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 06.09.06 11:08 
Moin!

Markierst du den Thread noch entsprechend, wenn dein Problem gelöst ist? Danke. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.