本文整理自网络,侵删。
function PosCh(ch: Char; const S: String): Integer;var I: Integer;begin for I:=1 to Length(S) do if S[I] = ch then begin result := I; Exit; end; result := 0;end;
function ExtractOwner(const S: String): String;var P: Integer;begin result := ''; P := PosCh('@', S); if P > 0 then result := Copy(S, 1, P - 1);end;
procedure TForm1.FormCreate(Sender: TObject);beginshowmessage(ExtractOwner('abc123@163.com'));end;
相关阅读 >>
Delphi使用ixmlhttprequest 简单获取网页源代码
更多相关阅读请进入《Delphi》频道 >>