<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD></HEAD><BODY dir=ltr>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV><FONT size=2>-----Original Message----- <BR><B>From:</B> 浜у搧寮€鍙戞妧鏈腑蹇?
  <BR><B>Sent:</B> 2001-9-30 (鏄熸湡鏃? 14:09 <BR><B>To:</B> 鍒樺嚡(澶?; 闄堟椽涔? 鎶€鏈腑蹇冨彂鍔ㄦ満閮? 
  绋嬫暀鑲? 璧电珛鏋? 榛勬椽; 鏉庡嵃鐢? 鍙茶嫳鏄? 鍊
  绋嬫暀鑲? 璧电珛鏋? 墡z妇iX??#隳#?3B???縍><B>Subject:</B> 
  閫氱煡<BR><BR></FONT></DIV>
  <DIV>缁忔鏌ワ紝椤圭洰绠$悊閮ㄣ€佸彂鍔ㄦ満閮ㄣ€佽瘯鍒惰溅闂淬€佺患鍚堢鐞嗛儴鏈兘鍦ㄨ瀹氭椂闂村唴瀹屾垚缃戜笂缂栧埗鏈堝伐浣滆鍒掑伐浣滐紝鐜颁腑蹇冩彁鍑轰弗鍘夋壒璇勶紝鑻ヤ笅娆℃煡鍑轰粛鏈湪瑙勫畾鏃堕棿瀹屾垚璁″垝缂栧埗宸ヤ綔涓ユ儵涓嶆€狅紒</DIV>
  <DIV>鐗规閫氱煡銆?/DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>涓績鍔炲叕瀹?/DIV>
  <DIV>2001骞?鏈?0鏃?/DIV></BLOCKQUOTE></BODY></HTML>

解决方案 »

  1.   

    ///////Begin Source
    uses
      Math;const
      cScaleChar = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';function IntToDigit(mNumber: Integer; mScale: Byte; mLength: Integer = 0): string;
    var
      I, J: Integer;
    begin
      Result := '';
      I := mNumber;
      while (I >= mScale) and (mScale > 1) do begin
        J := I mod mScale;
        I := I div mScale;
        Result := cScaleChar[J + 1] + Result;
      end;
      Result := cScaleChar[I + 1] + Result;
      for I := 1 to mLength - Length(Result) do Result := '0' + Result;
    end; { IntToDigit }function DigitToInt(mDigit: string; mScale: Byte): Integer;
    var
      I: Byte;
      L: Integer;
    begin
      Result := 0;
      L := Length(mDigit);
      for I := 1 to L do
        Result := Result + (Pos(mDigit[L - I + 1], cScaleChar) - 1) *
          Trunc(IntPower(mScale, I - 1));
    end; { DigitToInt }const
      cBase64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';function Base64Encode(mSource: string; mAddLine: Boolean = True): string;
    var
      I, J: Integer;
      S: string;
      T: string;
    begin
      Result := '';
      J := 0;
      for I := 0 to Length(mSource) div 3 - 1 do begin
        S := Copy(mSource, I * 3 + 1, 3);
        T := IntToDigit(Ord(S[1]), 2, 8) + IntToDigit(Ord(S[2]), 2, 8) + IntToDigit(Ord(S[3]), 2, 8);
        Result := Result + cBase64[DigitToInt(Copy(T, 01, 6), 2) + 1];
        Result := Result + cBase64[DigitToInt(Copy(T, 07, 6), 2) + 1];
        Result := Result + cBase64[DigitToInt(Copy(T, 13, 6), 2) + 1];
        Result := Result + cBase64[DigitToInt(Copy(T, 19, 6), 2) + 1];
        if mAddLine then begin
          Inc(J, 4);
          if J >= 76 then begin
            Result := Result + #13#10;
            J := 0;
          end;
        end;
      end;
      I := Length(mSource) div 3;
      S := Copy(mSource, I * 3 + 1, 3);
      case Length(S) of
        1: begin
          T := IntToDigit(Ord(S[1]), 2, 8) + '0000';
          Result := Result + cBase64[DigitToInt(Copy(T, 01, 6), 2) + 1];
          Result := Result + cBase64[DigitToInt(Copy(T, 07, 6), 2) + 1];
          Result := Result + '=';
          Result := Result + '=';
        end;
        2: begin
          T := IntToDigit(Ord(S[1]), 2, 8) + IntToDigit(Ord(S[2]), 2, 8) + '0000';
          Result := Result + cBase64[DigitToInt(Copy(T, 01, 6), 2) + 1];
          Result := Result + cBase64[DigitToInt(Copy(T, 07, 6), 2) + 1];
          Result := Result + cBase64[DigitToInt(Copy(T, 13, 6), 2) + 1];
          Result := Result + '=';
        end;
      end;
    end;function Base64Decode(mCode: string): string;
    var
      I, L: Integer;
      S: string;
      T: string;
    begin
      Result := '';
      L := Length(mCode);
      I := 1;
      while I <= L do begin
        if Pos(mCode[I], cBase64) > 0 then begin
          S := Copy(mCode, I, 4);
          if (Length(S) = 4) then begin
            T := IntToDigit(Pos(S[1], cBase64) - 1, 2, 6) +
                 IntToDigit(Pos(S[2], cBase64) - 1, 2, 6) +
                 IntToDigit(Pos(S[3], cBase64) - 1, 2, 6) +
                 IntToDigit(Pos(S[4], cBase64) - 1, 2, 6);
            Result := Result + Chr(DigitToInt(Copy(T, 01, 8), 2));
            if S[3] <> '=' then begin
              Result := Result + Chr(DigitToInt(Copy(T, 09, 8), 2));
              if S[4] <> '=' then
                Result := Result + Chr(DigitToInt(Copy(T, 17, 8), 2));
            end;
          end;
          Inc(I, 4);
        end else Inc(I);
      end;
    end; { Base64Decode }
    ///////End Source///////Begin Demo
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Memo2.Text := Base64Decode(Memo1.Text);
    end;
    ///////End Demo