如题

解决方案 »

  1.   

    可以用delphi的控件
    或者用现成函数
    const
     BaseTable:string='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';function TMailClient.FindInTable(CSource:char):integer;
    begin
      result:=Pos(string(CSource),BaseTable)-1;
    end;function DecodeBase64(Source:string):string;
    var
      SrcLen,Times,i:integer;
      x1,x2,x3,x4,xt:byte;
    begin
      result:='';
      SrcLen:=Length(Source);
      Times:=SrcLen div 4;
      for i:=0 to Times-1 do
      begin
        x1:=FindInTable(Source[1+i*4]);
        x2:=FindInTable(Source[2+i*4]);
        x3:=FindInTable(Source[3+i*4]);
        x4:=FindInTable(Source[4+i*4]);
        x1:=x1 shl 2;
        xt:=x2 shr 4;
        x1:=x1 or xt;
        x2:=x2 shl 4;
        result:=result+chr(x1);
        if x3= 64 then break;
        xt:=x3 shr 2;
        x2:=x2 or xt;
        x3:=x3 shl 6;
        result:=result+chr(x2);
        if x4=64 then break;
        x3:=x3 or x4;
        result:=result+chr(x3);
      end;
    end;