Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi String teilen??? (https://www.delphipraxis.net/13053-string-teilen.html)

ralfi 10. Dez 2003 10:51


String teilen???
 
Hallo!

Ich habe z. B. ein Text im Memo:

Ralf Mustermann
Musterstrasse 1
10000 Berlin


Wie kann ich jede Zeile in einen String umwandelt?

Garby 10. Dez 2003 10:54

Re: String teilen???
 
Hallo,
Delphi-Quellcode:
Stringvariable := Memo.Lines.Text;

choose 10. Dez 2003 10:59

Re: String teilen???
 
bzw
Delphi-Quellcode:
Assert(Memo1.Lines.Count>=3, 'Expecting 3 lines in Memo');

myName:= Memo1.Lines[0];
myStreet:= Memo1.Lines[1];
myCity:= Memo1.Lines[2];

Luckie 10. Dez 2003 11:01

Re: String teilen???
 
Er woillte jede einzeln haben:
Delphi-Quellcode:
var
  s: String;
  Loop: Integer;
begin
  for Loop := 0 to Memo1.Lines.Count - 1 do
  begin
    s := Memo1.Lines.Strings[Loop];
    ShowMessage(s);
  end;

Grumble 10. Dez 2003 11:01

Re: String teilen???
 
also wenn du je zeile einen string haben willst oder nur eine bestimmte zeile dann wohl so:

Delphi-Quellcode:
memo1.Lines.Strings[i-1];
wobei i die zeile angibt, -1 nur fallss das im memo auch bei 0 zu zaehlen anfaengt

gruesse
grumble


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:43 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz