Autor Beitrag
Leathl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Fr 28.02.03 18:20 
---


Zuletzt bearbeitet von Leathl am So 16.08.09 13:09, insgesamt 1-mal bearbeitet
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Fr 28.02.03 18:36 
Hallo schau dir mal copy,Pos und delete an.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Leathl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Fr 28.02.03 18:46 
---


Zuletzt bearbeitet von Leathl am So 16.08.09 13:09, insgesamt 1-mal bearbeitet
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Fr 28.02.03 18:49 
Na was unterscheidet denn das erste Wort vom zweiten? irgendwas muß dazwischen sein. frage mit Pos(' ',s) das erste Leerzeichen ab und lösch dann den Rest

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Leathl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Fr 28.02.03 19:03 
---


Zuletzt bearbeitet von Leathl am So 16.08.09 13:09, insgesamt 1-mal bearbeitet
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Fr 28.02.03 19:06 
Was er meint, ist: Du suchst nach dem ersten Zeichen, welches kein Buchstabe ist. Dort endet das erste Wort. Dann weißt Du, wo Du abschneiden musst.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Leathl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Fr 28.02.03 19:49 
---


Zuletzt bearbeitet von Leathl am So 16.08.09 13:10, insgesamt 1-mal bearbeitet
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Fr 28.02.03 20:20 
es kommt drauf an, wie die Zeilen aufgebaut sind
entweder du hangelst dich einzeln durch den String und suchst dein "Trennzeichen" (wie Peter) oder du gehst (wie ich jetzt) davon aus, daß die Wörter mit einem Leerzeichen getrennt sind (also nix mit Komma oder so)

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Button1Click(Sender: TObject);
Var i,_pos:integer;
    s:string;
begin
  for i:=0 to Memo1.Lines.count-1 do
    begin
      s:=memo1.lines[i];
      _pos:=pos(' ',s);
      if _pos<>0 then
        //Leerzeichen gefunden, rest der zeile abknipsen
        begin
          delete(s,_pos,length(s)-_pos+1);
          memo1.lines[i]:=s;
        end;
    end;
end;


so schwer ist das doch nicht, oder?

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 28.02.03 20:24 
So jetzt mal ohne Debugger blind hier reingehauen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  i : Integer;
  s : String;
begin
  for i := 0 to Memo1.Lines.Count-1 d
  begin
     s := copy(Memo1.Items.Strings[i], 0, pos(' ', Memo1.Items.Strings[i]));   
     ShowMessage(s);
  end;
Leathl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Fr 28.02.03 20:35 
---