Note: I am using Delphi 7.
Is there a way to split a string by a line break?
I would like something like the following:
procedure Split
(const Delimiter: Char;
Input: string;
const Strings: TStrings) ;
begin
Assert(Assigned(Strings)) ;
Strings.Clear;
Strings.Delimiter := Delimiter;
Strings.DelimitedText := Input;
end;
var
xMSG:String;
xStr:String;
xStrList:TStrings;
xLineBreak:String;
xHello:String;
xWorld:String;
begin
xLineBreak := AnsiString(#13#10);
xMSG := 'Hello ' + xLineBreak + 'World';
xStrList := TStringList.Create;
Split(xLineBreak,AnsiString(xMSG),xStrList);
xHello := xStrList[0];
xWorld := xStrList[1];
MessageBox(0,PAnsiChar(xHello + xWorld),'Test',0);
end.