Function Before( Src:string ; S:string ): string ;
var
F: Word ;
begin
F:= POS(Src,S) ;
if F=0 then
Before := S
else
Before := COPY(S,1,F-1) ;
end ;
function After(Src: string; S: string):string;
var
F: Word;
begin
F:= Pos(Src, S);
if F = 0 then
After:= ''
else
After:= Copy(S, F+Length(Src), Length(S));
end;
tmp := '1232$$23423432';
showmessage(Before('$$',tmp));
showmessage(after('$$',tmp));
function SplitString(const source, ch: string): TStringList;
var
temp, t2: string;
i: integer;
begin
result := TStringList.Create;
temp := source;
i := pos(ch, source);
while i <> 0 do
begin
t2 := copy(temp, 0, i - 1);
if (t2 <> '') then
result.Add(t2);
delete(temp, 1, i - 1 + Length(ch));
i := pos(ch, temp);
end;
result.Add(temp);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
st : TStringList;
begin
st := SplitString('xxx@hoho.com', '@');
showmessage(st[1]);
end;