Autor Beitrag
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 19.05.04 17:54 
Tach Leude.
Ich hab folgendes vor: Ich will eine Art Scripteditor für das Spiel Blitzkrieg sschreiben, was sich als leicht heraus stellt, solange man nicht eine Fehlerkorrektur einbauen will. Das aber ist sehr wichtig für das Programm!
Ich hab an einen Algorythmus gedacht, aber ich wusste nicht, wie ich Beispielsweise
aus der Zeile
ausblenden Quelltext
1:
Funktion name1(;					

Die Fehler -"function" klein und mit c
-"name1()" ohne ; mit )
herausfinde und korrigiere. Das grösste problem ist der "name1", denn das kann alles sein von 1 bis zzzzzzzzzzzzzzzzzz.

Kurz: Wie kann ich aus einem Memo einzelne Textteile auslesen, deren Position ich nicht kenne, und diese evntl. verändern?

Ich warte gespannt auf Antworten! Danke im Voraus!

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
aM0xACiLLiN
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Mi 19.05.04 18:49 
Hi,

die einfachste und schnellste möglichkeit ist wohl StringReplace:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var s:string;
begin
s:=Memo1.Text;
s:=StringReplace(s,'funktion','function',[rfReplaceAll]);
s:=StringReplace(s,'(;','()',[rfReplaceAll]);
Memo1.Text:=s;
end;


cu
JayEff Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 19.05.04 19:21 
Jaaa! Dankeeeee! man das ist gut!
*freu*

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.