Einzelnen Beitrag anzeigen

xaromz

Registriert seit: 18. Mär 2005
1.682 Beiträge
 
Delphi 2006 Enterprise
 
#4

Re: string an bestimmtem Zeichen teilen

  Alt 3. Okt 2007, 13:14
Hallo,

dafür gibt's die Funktion Copy().
In Deinem Fall sähe das so aus:
Delphi-Quellcode:
var
  S: String;
  I: Integer;
  First, Second: String;
begin
  S := 'hallo,wie gehts? |123:34.blabla';
  I := Pos('|', S);
  First := Copy(S, 1, I - 1); // First = "hallo,wie gehts? "
  Second := Copy(S, I + 1, MaxInt); // Second = "123:34.blabla"
end;
Natürlich musst Du noch prüfen, ob I > Null ist.

Gruß
xaromz
I am a leaf on the wind - watch how I soar
  Mit Zitat antworten Zitat