Autor Beitrag
BlackRaven
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 25.10.03 02:18 
Ich möche bei einem OnKeyPress Ereihbis nach Key=#13 suchen ob ein bestimmter string im Editfeld steht. Wie mache ich das?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 25.10.03 03:55 
Suche in: Delphi-Forum, Delphi-Library POS Und alle damit zusammenhängenden Stringfunktionen.
BlackRaven Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 25.10.03 13:10 
ich hab das jetzt so realisiert.
aber dafür müsste es doch noch eine einefachere Lösung geben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
var
  LinkE: Boolean;
  LinkD: Boolean;
  Link2: Boolean;
  LinkK: Boolean;
  Linkdp: Boolean;
begin
if Key=#13 then
  begin
//erstmal schauen ob es ein ed2k link ist->start
  if pos('e',ComboBox1.Text)=1 then LinkE:=true else if pos('E',ComboBox1.Text)=1 then LinkE:=true;
  if pos('d',ComboBox1.Text)=2 then LinkD:=true else if pos('D',ComboBox1.Text)=2 then LinkD:=true;
  if pos('2',ComboBox1.Text)=3 then Link2:=true;
  if pos('k',ComboBox1.Text)=4 then LinkK:=true else if pos('K',ComboBox1.Text)=4 then LinkK:=true;
  if pos(':',ComboBox1.Text)=5 then Linkdp:=true;
  if (LinkE and LinkD and Link2 and LinkK and Linkdp)=true then Showmessage('ED2K Link');
  if (LinkE and LinkD and Link2 and LinkK and Linkdp)=true then ed2k.CheckListBox1.Items.Add(ComboBox1.Text);
//erstmal schauen ob es ein ed2k link ist->ende
end;
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Sa 25.10.03 13:24 
Titel: hmm,
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  if pos('e',ComboBox1.Text)=1 then LinkE:=true else if pos('E',ComboBox1.Text)=1 then LinkE:=true; 
  if pos('d',ComboBox1.Text)=2 then LinkD:=true else if pos('D',ComboBox1.Text)=2 then LinkD:=true; 
  if pos('2',ComboBox1.Text)=3 then Link2:=true; 
  if pos('k',ComboBox1.Text)=4 then LinkK:=true else if pos('K',ComboBox1.Text)=4 then LinkK:=true; 
  if pos(':',ComboBox1.Text)=5 then Linkdp:=true;


kannste abkürzen =>

ausblenden Delphi-Quelltext
1:
 if POS('ED2K:',UPPERCASE(edit1.text)) = 1 then edit2.Text := 'iss an erster Stelle';					

_________________
mfg. Joel
BlackRaven Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 25.10.03 13:30 
thx, das sieht schonmal gut aus, ich probiers morgen früh aus, ich muss jetzt auf arbeit
vielen dank nochmal