¥?
if a=$ then
a=¥

解决方案 »

  1.   

    连这个问题都看不懂!好,给你举个例子:
    $1234.50 --〉USD ONE THOUSAND TWO HUNDRED AND THIRTY-FOUR AND FIFTY CENTS ONLY  
      

  2.   

    //from
    //http://www.csdn.net/expert/Topic/213/213457.shtm
    //for Delphi6.0//if Delphi5.0//function LeftStr(const AText: string; const ACount: Integer): string;
    //begin
    //  Result := Copy(AText, 1, ACount);
    //end;
    //
    //function RightStr(const AText: string; const ACount: Integer): string;
    //begin
    //  Result := Copy(AText, Length(AText) + 1 - ACount, ACount);
    //end;
    uses
      StrUtils;function DigitToEn(strDigits: String; intRMB: Boolean): String;
      //将在1-19之间的数字转换成英文表示法
      function DigitToEn1(strDigits: String): String;
      begin
        Case StrToInt(strDigits) of
          1: Result := 'ONE';
          2: Result := 'TWO';
          3: Result := 'THREE';
          4: Result := 'FOUR';
          5: Result := 'FIVE';
          6: Result := 'SIX';
          7: Result := 'SEVEN';
          8: Result := 'EIGHT';
          9: Result := 'NINE';
          10: Result := 'TEN';
          11: Result := 'ELEVEN';
          12: Result := 'TWELVE';
          13: Result := 'THIRTEEN';
          14: Result := 'FOURTEEN';
          15: Result := 'FifTEEN';
          16: Result := 'SIXTEEN';
          17: Result := 'SEVENTEEN';
          18: Result := 'EIGHTEEN';
          19: Result := 'NINETEEN';
        else
          Result := '';
        end;
      end;
      //将在1-99之间的数字转换成英文表示法
      function DigitToEn2(strDigits: String): String;
      var
        strTemp: String;
      begin
        if StrToInt(strDigits) < 20 then
          Result := DigitToEn1(strDigits)
        else begin
          Case StrToInt(LeftStr(strDigits, 1)) of
            2: strTemp := 'TWENTY';
            3: strTemp := 'THIRTY';
            4: strTemp := 'FORTY';
            5: strTemp := 'FIFTY';
            6: strTemp := 'SIXTY';
            7: strTemp := 'SEVENTY';
            8: strTemp := 'EIGHTY';
            9: strTemp := 'NINETY';
          else
            strTemp := '';
          end;      if RightStr(strDigits, 1) <> '0' then
              strTemp := strTemp + '-' + DigitToEn1(RightStr(strDigits, 1));      Result := strTemp;
        end;
      end;
      //将在1-999之间的数字转换成英文表示法
      //如intFormat为1,则在HUNDRED 后面就有 AND,否则没有。
      function DigitToEn3(strDigits: String; intFormat: Integer): String;
      begin
        //去掉数字串前面的0
        strDigits := IntToStr(StrToInt(strDigits));    if StrToFloat(strDigits) <= 19 then
          Result := DigitToEn1(strDigits)
        else if (StrToFloat(strDigits) >= 20) and (StrToFloat(strDigits) <= 99) then
          Result := DigitToEn2(strDigits)
        else begin
          Result := DigitToEn1(LeftStr(strDigits, 1)) + ' HUNDRED';
          if (StrToFloat(RightStr(strDigits, 2)) > 0) and
            (StrToFloat(RightStr(strDigits, 2)) < 20) then
            if intFormat = 1 then
              Result := Result + ' AND ' + DigitToEn1(RightStr(strDigits, 2))
            else
              Result := Result + ' ' + DigitToEn1(RightStr(strDigits, 2))
          else if (StrToFloat(RightStr(strDigits, 2)) >= 20)
            and (StrToFloat(RightStr(strDigits, 2)) <= 99) then
            if intFormat = 1 then
              Result := Result + ' AND ' + DigitToEn2(RightStr(strDigits, 2))
            else
              Result := Result + ' ' + DigitToEn2(RightStr(strDigits, 2));
        end;
      end;var
      // 整数部份 小数部份
      strInteger, strDecimal: String;
      strTemp: String;
    begin
      if (StrToFloat(strDigits) > 99999999.99) or
        (StrToFloat(strDigits) < 0.01) then
        raise exception.Create('Out of range, must between 0.01 - 99999999.99');  //有整数部分及小数部分
      if (Int(StrToFloat(strDigits)) > 0) and
        (StrToFloat(strDigits) - Int(StrToFloat(strDigits)) > 0) then
      begin
        strInteger := LeftStr(strDigits, Pos('.', strDigits) - 1);
        strDecimal := RightStr(strDigits, Length(strDigits) - Pos('.', strDigits));
      end
      //只有整数部分
      else if Int(StrToFloat(strDigits)) > 0 then
        strInteger := IntToStr(Round(StrToFloat(strDigits)))
      //只有小数部分
      else if StrToFloat(strDigits) - Int(StrToFloat(strDigits)) > 0 then
        strDecimal := RightStr(strDigits, Length(strDigits) - Pos('.', strDigits));  //得到整数部分英文表示法
      if strInteger <> '' then begin
        strTemp := DigitToEn3(RightStr(strInteger, 3), 1);
        if Length(strInteger) > 3 then begin
          strTemp := DigitToEn3(LeftStr(RightStr(strInteger, 6),
            Length(RightStr(strInteger, 6)) - 3), 2) + ' THOUSAND ' + strTemp;
          if Length(strInteger) > 6 then
            strTemp := DigitToEn3(LeftStr(strInteger, Length(strInteger) - 6), 2) +
            ' MILLION ' + strTemp;
        end;
        strInteger := strTemp;
      end;  if (strDecimal <> '') and (Length(strDecimal) <= 3) then
        strDecimal := DigitToEn3(strDecimal, 1);  if (strInteger <> '') and (strDecimal <> '') then
        if intRMB then
          Result := strInteger + ' YUANS AND ' + strDecimal + ' CENTS ONLY'
        else
          Result := strInteger + ' DOLLARS AND ' + strDecimal + ' CENTS ONLY'
      else if strInteger <> '' then
        if intRMB then
          Result := strInteger + ' YUANS ONLY'
        else
          Result := strInteger + ' DOLLARS ONLY'
      else if strDecimal <> '' then
        Result := strDecimal + ' CENTS ONLY'
      else
        Result := 'ZERO';
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
      S: string;
    begin
      S := '$1234.50';
      Delete(S, 1, 1);
      Edit1.Text := 'USE ' + DigitToEn(S, False);
    end;
      

  3.   

    : zswang(伴水)(需要充充电)  服你了。呵呵