Autor Beitrag
kulka1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mo 05.10.09 16:00 
Hallo,

ich habe eine frage und zwar:

wie kann ich einen Satz auseinander nehmen?

also das man in einem editfeld ein satz eingibt, und beim klick auf den button sollen die einzelnen wörter untereinander in einem memofeld erscheinen!

wäre nett wenn mir jmd helfen kann, evtl mit code ;)

mfg kulka
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mo 05.10.09 16:03 
nun ja, eigentlich brauchst du ja nur mittels PosEx nach leerzeichen suchen und dann mit copy vom index des letzten leerzeichens bis zum index des aktuellen leerzeichens kopieren, oder? ;)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 05.10.09 16:09 
Wenn man eh in einem Memo ausgeben möchtes, könnte man auch DelimitedText nehmen.

_________________
PROGRAMMER: A device for converting coffee into software.
kulka1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mo 05.10.09 18:13 
ok, danke, ich werd es mal probieren und werde mich dann wieder zu euch wenden ;)

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
var eingabe, ausgabe: String;
  i : integer;
begin
  Memo1.Clear;
  eingabe := edit1.text;
  i := pos(' ',eingabe);

  Memo1.Lines.Add(eingabe);

  while (i <> 0do
  begin
    ausgabe := copy(eingabe,1,i);

  end;
   Memo1.Lines.Add(ausgabe);
end;

das geht aber iwie nicht -.-*, ist bestimmt ne menge mist drin, könnt ihr es verbessern =)^^
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 05.10.09 21:00 
Ähm.. ne, das wird so nichts.. z.B. suchst nur EIN Mal, nämlich vor der Schleife, nach dem Leerzeichen.
Schreib am besten an jede Zeile einen Kommentar dran, was da deiner Meinung nach geschieht ;)
Und danach könntest du dir mal überlegen, wie du es selber machen würdest, also wenn du diese Aufgabe z.B. auf einem Blatt Papier lösen müsstest.

_________________
PROGRAMMER: A device for converting coffee into software.
Tryer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 226
Erhaltene Danke: 7



BeitragVerfasst: Di 06.10.09 17:07 
Wenn DelimitedText Dir nicht zusagt dann tausch doch einfach "selber" die Leerzeichen gegen Zeilenumbrüche aus.
ausblenden Delphi-Quelltext
1:
Memo1.Text := StringReplace(Edit1.Text, #32#13#10, [rfReplaceAll]);					
kulka1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Sa 10.10.09 20:40 
mhm naja, ich hab es jetzt,

mit pos nach leerzeichen gesucht, und mit copy den satz abgeschnitten

das ganze hab ich in einer while schleife gemacht

danke!