function SplitStr(const S, Delim: string; out S1, S2: string): Boolean;
var
DelimPos: Integer; // position of delimiter in source string
begin
// Find position of first occurence of delimiter in string
DelimPos := SysUtils.AnsiPos(Delim, S);
if DelimPos > 0 then
begin
// Delimiter found: split and return True
S1 := Copy(S, 1, DelimPos - 1);
S2 := Copy(S, DelimPos + Length(Delim), MaxInt);
Result := True;
end
else
begin
// Delimiter not found: return false and set S1 to whole string
S1 := S;
S2 := '';
Result := False;
end;
end;
//delphi/2326