AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Items aus einem Memo-feld sortieren

Ein Thema von phoffi1 · begonnen am 13. Jul 2006 · letzter Beitrag vom 13. Jul 2006
Antwort Antwort
phoffi1

Registriert seit: 8. Nov 2005
Ort: Landau in der Pfalz
3 Beiträge
 
#1

Items aus einem Memo-feld sortieren

  Alt 13. Jul 2006, 17:14
Hallo,

es geht um folgendes:
Ich habe ein Memo-Feld mit verschiedenen Seriennummern:

z.B.:

|--------|
| E604 |
| E603 |
| E609 |
| E603 |
| E609 |
| E612 |
| E642 |
| E604 |
| E603 |
| E612 |
|--------|

Nun möchte ich die Seriennummern sortieren, sodass jede Seriennummer nur einmal vorkommt.
Dies soll dann in einem zweiten Memo-Feld ausgegeben werden.
Das würde dann z.B. so aussehen:

|--------|
| E603 |
| E604 |
| E609 |
| E612 |
| E642 |
|--------|


Ich hab schon vieles probiert aber brauche Hilfe.
Danke
Patrick
  Mit Zitat antworten Zitat
Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.755 Beiträge
 
Delphi 10.4 Sydney
 
#2

Re: Items aus einem Memo-feld sortieren

  Alt 13. Jul 2006, 17:19
Aus der Hilfe von TStringList:

Zitat:
Specifies whether duplicate strings can be added to sorted lists.

property Duplicates: TDuplicates;

Description

Set Duplicates to specify what should happen when an attempt is made to add a duplicate string to a sorted list. The CaseSensitive property controls whether two strings are considered duplicates if they are identical except for differences in case.

The value of Duplicates should be one of the following.

Value Meaning

dupIgnore Ignore attempts to add duplicate strings to the list.
dupError Raise an EStringListError exception when an attempt is made to add duplicate strings to the sorted list.
dupAccept Permit duplicate strings in the sorted list.

Set Duplicates before adding any strings to the list. Setting Duplicates to dupIgnore or dupError does nothing about duplicate strings that are already in the list.

Note: Duplicates does nothing if the list is not sorted.


Da kannst Du die Zeilen des Memofeldes in eine StringList übertragen.
Die Stringlist dann wieder in das Memofeld schreiben.
Ob sich das Ausfiltern direkt im Memo machen läßt weiß ich nicht.

Grüße
Klaus
Klaus
  Mit Zitat antworten Zitat
Benutzerbild von semo
semo

Registriert seit: 24. Apr 2004
755 Beiträge
 
Delphi 2010 Professional
 
#3

Re: Items aus einem Memo-feld sortieren

  Alt 13. Jul 2006, 17:26
à la Klaus01: (bzw. für die Französischkenner unter euch "à le Klaus01" *g*):
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  aSL: TStringList;
begin
  aSL := TStringList.Create;
  aSL.Sorted := true;
  aSL.Duplicates := dupAccept;
  aSL.Assign(Memo1.Lines);

  Memo1.Lines.Assign(aSL);

  aSL.Free;
end;
im Memo direkt sortieren ist nicht möglich,
die Stringlist ist ja extra dafür geschaffen worden um TStrings sortieren zu können.
  Mit Zitat antworten Zitat
phoffi1

Registriert seit: 8. Nov 2005
Ort: Landau in der Pfalz
3 Beiträge
 
#4

Re: Items aus einem Memo-feld sortieren

  Alt 13. Jul 2006, 17:34
Danke, hat alles geklappt.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:29 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz