Autor Beitrag
Killi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 299

Win*
D6 Prof
BeitragVerfasst: Mo 23.06.03 13:17 
Hi!

Wie kann ich zum Beispiel sowas hier machen:
Ich habe einen String, z.Bsp.
ausblenden Quelltext
1:
Keilman #flirt.de CapriCorn i.wish.to.b-per-fact.de BelWue.DE Ca...					

und will NUR das CapriCorn raushaben - ich habe schon User.lines.Add(Copy(Text, Pos(WhoBefehl, Text) + Length(WhoBefehl), Length(Text))); gemacht - aber das geht nat. ab dem Usernamen bis Zum Textende - wie kann ich denn jetzt ab dem Usernamen bis zum nächsten LEERzeichen machen???
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Mo 23.06.03 13:25 
Wenn
ausblenden Delphi-Quelltext
1:
2:
  Text='Keilman #flirt.de CapriCorn i.wish.to.b-per-fact.de BelWue.DE Ca...';
  WhoBefehl='CapriCorn';


dann müsste gehen

ausblenden Delphi-Quelltext
1:
Copy(Text, Pos(WhoBefehl, Text), Length(WhoBefehl));					


Dann bekomsmt du das 'CapriCorn'

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
Killi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 299

Win*
D6 Prof
BeitragVerfasst: Mo 23.06.03 13:27 
Nee, das WhoBefehl ist was ganz anderes - habs jetzt so gemacht, sieht kompliziert aus, ist aber 2x fast das gleiche ineinander verschachtelt ;-)
ausblenden Quelltext
1:
2:
3:
        WhoBefehl:= XiRC1.UserInfo.Nick + ' ' + Raum + ' ';

        User.lines.Add(Copy(Text, Pos(WhoBefehl, Text) + Length(WhoBefehl), Pos(' ', Copy(Text, Pos(WhoBefehl, Text) + Length(WhoBefehl), Length(Text)))));
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 23.06.03 13:27 
Was macht es denn für einen Sinn nach einen Text in einem String zu suchen und diesen Suchtext als Ergebnis zu liefert?
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Mo 23.06.03 13:36 
Auf die Schnelle:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.Button1Click(Sender: TObject);
var
  s1, s2: String;
  i: Integer;
begin
  s1 := 'Keilman #flirt.de CapriCorn i.wish.to.b-per-fact.de BelWue.DE Ca...';

  s2 := s1;
  for i := 1 to 2 do Delete(s2, 1, Pos(#32, s2));
  s2 := Trim(Copy(s2, 1, Pos(#32, s2)));

  ShowMessage(s2);
end;

_________________
Popov