5,392
社区成员
发帖
与我相关
我的任务
分享
function TForm1.Base64Decode(strInput:string):string;
var
strDecode : string;
posStart : Integer;
posEnd : Integer;
IdDecoderMIME1: TIdDecoderMIME;
begin
IdDecoderMIME1:=TIdDecoderMIME.Create(nil);
while pos('=?gb2312?b?',lowercase(strInput))>0 do
begin
try
posStart:=pos('=?gb2312?b?',lowercase(strInput));
posEnd:=pos('?=',lowercase(strInput));
strDecode:=strDecode+copy(strInput,1,posStart-1)+IdDecoderMIME1.DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
strDecode:=strDecode+copy(strInput,1,posStart-1)+ DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
strInput:=copy(strInput,posEnd+2,length(strInput)-posEnd-1);
finally
Application.ProcessMessages;
end;
end;
strDecode := strDecode + strInput;
result := strDecode;
end;