X:= AnsiPos('#',S);
if X <> 0 then begin
S1:= Copy(S, 1, X-1);
S2:= Copy(S, X+1, Length(S)-X);
end;
-------------------------------------
Unit
SysUtils
AnsiPos locates the position of a substring within a string.
function AnsiPos(const Substr, S: string): Integer;
Description
Call AnsiPos to obtain the byte offset of the Substr parameter, as it appears in the string S. For example, if Substr is the string 'AB', and S is the string 'ABCDE', AnsiPos returns 1. If Substr does not appear in the string S, AnsiPos returns 0.
Note
This function supports double-byte character sets (DBCS).