EncdDecd 单元: EncodeString、DecodeString、EncodeBase64、DecodeBase64
uses EncdDecd; const str = '万一的 Delphi 博客'; procedure TForm1.Button1Click(Sender: TObject); var strEncode,strDecode: string; begin strEncode := EncodeString(str); strDecode := DecodeString(strEncode); ShowMessageFmt('%s'#10#13'%s', [strEncode, strDecode]); end; procedure TForm1.Button2Click(Sender: TObject); var strEncode,strDecode: string; begin strEncode := EncodeBase64(BytesOf(str), Length(BytesOf(str))); strDecode := StringOf(DecodeBase64(strEncode)); ShowMessageFmt('%s'#10#13'%s', [strEncode, strDecode]); end;New: System.NetEncoding