Autor Beitrag
TheAxeEffect
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Di 02.10.07 17:19 
hi liebe community,
ich wollte fragen, ob es in delphi die möglichkeit gibt string direkt in code umzuwandeln, oder ob ich den string erst umständlich auslesen muss.
ein beispiel:
ich hab nen button.
bei der prozedur button1.click steht drinne:
strtocode(edit1.text);
wenn ich jetzt in edit1 "exit;" reinschreibe, hätte ich gerne, dass er "exit" ausführt.
vllt. ne blöde frage, aber gibt es sowas?
mfg,
simon
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 02.10.07 17:37 
Suche in der Entwickler-Ecke CODE EINGEBEN
Da findest shcon was.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Di 02.10.07 17:40 
Soweit ich weiß, nicht. Dass müsstest du dann schon selber irgendwie parsen. Dafür würde ich mir zuerst mal eine Liste aller Funktionen/Prozeduren beschaffen.

Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
searchword := 'exit';
if Copy(Trim(mystr),1,Length(searchword)) = searchword then
begin
  exit;
  exit;
end;
Ich weiß nicht zu 100%, ob das mit den zwei exit; richtig ist, denke ich aber schon, weil einmal müsste er ja den begin-end verlassen und das andere Mal unterbricht er deinen Code.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 02.10.07 17:48 
Doch, das geht. Man muss das halt parsen. Und dafür gibts Units/Komponenten - erst vor kurzem gabs so nen Thread hier, den müsste man über die Suche recht fix finden.

Das mit den zwei Exits ist Murks - ein Exit beendet die Prozedur. (Break war das, was nur aus der Schleife rausspringt.)

_________________
We are, we were and will not be.
TheAxeEffect Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Fr 05.10.07 15:48 
vielen dank für eure hilfe,
mfg,
simon