Autor Beitrag
Hochhäusl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Do 17.12.09 10:57 
Hallo,

ich frage mich ob es möglich ist, die ersten beiden Zeichen eines Listboxeintrags zu löschen?

Listbox:
x=230
y=2124
...


Danach soll nur noch 230 bzw. 2124 in der Listbox stehen.

Gibts da eine Möglichkeit?
Tastaro
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 414
Erhaltene Danke: 23



BeitragVerfasst: Do 17.12.09 11:01 
Mit der Prozedur delete kann man Zeichen aus Strings löschen. Mehr verrät die Online-Hilfe.

Beste Grüße
Hochhäusl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Do 17.12.09 11:17 
Danke für die schnelle Antwort.

Ich habe bereits "Delete" ausprobiert, nur kann ich da nur immer einen ganzen Eintrag löschen.

ausblenden Delphi-Quelltext
1:
listbox1.Items.Delete(2);					

ausblenden Delphi-Quelltext
1:
listbox1.Items.Delete(StrToInt('X0'));					


In der Online-Hilfe hab ich leider auch nichts nützliches gefunden
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Do 17.12.09 11:20 
Er meinte die Routine Delete aus der Unit SysUtils:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  s: String;
begin
  //ersten Listeintrag in String kopieren
  s := ListBox1.Items[0];
  //2 Zeichen aus dem String löschen, der 2te Parameter gibt den Start-Index an
  Delete(s, 12);
  //String wieder in ListBox kopieren
  ListBox1.Items[0] := s;
end;
Hochhäusl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Do 17.12.09 11:22 
Danke für die Hilfe
:D