EncdDecd 單元: EncodeString、DecodeString、EncodeBase6四、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;