Autor Beitrag
delphistart
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 119



BeitragVerfasst: Sa 09.12.06 18:20 
Hallo,

Ich habe ein denke ich eigentlich kleines Problem, aber ich finde einfach keine Lösung:
Ich habe ein Variable des Typs String. Ich weis, dass diese zwischen 1 bis 13 Stellen hat und nut möchte ich die erste Stelle durch eine 0 ersetzen. Also venn ich z.B. HalloDu im String habe, soll das zu 0alloDu geändert werden.

Danke schonmal für die Hilfe
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Sa 09.12.06 18:23 
ausblenden Delphi-Quelltext
1:
s[1]:= '0'					


Was auch immer das bringen soll ;)

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
stifflersmom
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 194

XP /XP PRO/ SuSE div.
D1 - D7, BDS 2006
BeitragVerfasst: Sa 09.12.06 18:24 
Ok

ausblenden Delphi-Quelltext
1:
2:
MyString := 'Irgendwas';
MyString[1] := '0';

Das war's

Moin
delphistart Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 119



BeitragVerfasst: Sa 09.12.06 18:26 
Das hatte ich auch schon probiert, aber da sagt der Compiller

Unit9.pas(188): E2064 Der linken Seite kann nichts zugewiesen werden

Der Code:
ausblenden Delphi-Quelltext
1:
Label1.Caption[1]:='0';					
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 09.12.06 18:30 
TCaption ist ja auch kein String. ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
delphistart Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 119



BeitragVerfasst: Sa 09.12.06 18:32 
user profile iconMarco D. hat folgendes geschrieben:
TCaption ist ja auch kein String. ;)

Und wie kann ich dann die erste Stelle der Caption ändern?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Sa 09.12.06 18:33 
Zitat:
TCaption ist ja auch kein String. ;)
Doch eigentlich schon, aber label.Text ist ne Property. Du mußt den Umweg ber eine lokale Variable gehn:

ausblenden Delphi-Quelltext
1:
2:
s := Label1.Caption; s[1] := '0'; 
Label1.Caption := s;

_________________
Markus Kinzler.
delphistart Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 119



BeitragVerfasst: Sa 09.12.06 18:39 
user profile iconmkinzler hat folgendes geschrieben:
Zitat:
TCaption ist ja auch kein String. ;)
Doch eigentlich schon, aber label.Text ist ne Property. Du mußt den Umweg ber eine lokale Variable gehn:

ausblenden Delphi-Quelltext
1:
2:
s := Label1.Caption; s[1] := '0'; 
Label1.Caption := s;


Danke! Hast mir sehr geholfen! Jetzt gehts! :think:
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 09.12.06 18:48 
aus der hüfte geschossen:

ausblenden Delphi-Quelltext
1:
Label1.Caption := '0' + copy(Label1.Caption, 2, length(Label1.Caption)-1));					


Edit:mei, bin i langsam...