Autor Beitrag
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Sa 25.06.05 00:04 
Hi
Und weiter gehts! :D
Wie kann ich den ersten Buchstabe aus dem ersten Item einer StringList löschen?
Müsste ja ungefähr sowas sein:  StringList1[0][0] := '';
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 25.06.05 00:40 
ausblenden Delphi-Quelltext
1:
2:
  if SL.Count > 0 then
    SL.Strings[0] := Copy(SL.Strings[0], 2, MaxInt);

_________________
Ciao, Sprint.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Sa 25.06.05 14:30 
Sieh dir mal auf meiner HP das "Tutorial" für Stringoperationen an. Speziell "Delete" und "Copy".
In deinem Fall ist Delete wohl besser. Kannst natürlich auch die DOH von Delphi bemühen.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Sa 25.06.05 14:43 
Das Problem bei der Stringliste (und allgemein allen Eigenschaften von Objekten) ist die, das sie nicht 100% wie Variablen behandelt werden können. Ebensowenig wie
ausblenden Delphi-Quelltext
1:
Inc (aObject.MyProperty)					

funktioniert, geht eben ein
ausblenden Delphi-Quelltext
1:
aStringList[0][1] := 'x';					

Ersteres geht über
ausblenden Delphi-Quelltext
1:
aObject.MyProperty := aObject.MyProperty + 1					

und das Stringlistelement wird so modifiziert:
ausblenden Delphi-Quelltext
1:
2:
3:
  aString := aStringList[0];
  aString [1] := 'x';
  aStringList[0] := aString;

wobei das eventuell noch einfacher ist. Das Prinzip ist aber klar.
Ebensowenig können Properties als Var-Parameter übergeben werden.
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Sa 25.06.05 23:24 
Ok, danke an alle!
Hier nochmal der Sourcecode den ich benutze :
ausblenden Delphi-Quelltext
1:
2:
3:
  s := StringList1[0];
  delete(s,1,2);
  StringList1[0] := s;

:wave: