function SmallTOBig(small: real): string;
var 
  SmallMonth, BigMonth: string;
  wei1, qianwei1: string[2];
  qianwei, dianweizhi, qian: integer;
  fs_bj: boolean;
begin
  if small < 0 then
    fs_bj := True
  else
    fs_bj := False;
  small      := abs(small);
  {------- 修改参数令值更精确 -------}
  {小数点后的位置,需要的话也可以改动-2值}
  qianwei    := -2;
  {转换成货币形式,需要的话小数点后加多几个零}
  Smallmonth := formatfloat('0.00', small);
  {---------------------------------}
  dianweizhi := pos('.', Smallmonth);{小数点的位置}
  {循环小写货币的每一位,从小写的右边位置到左边}
  for qian := length(Smallmonth) downto 1 do
  begin
    {如果读到的不是小数点就继续}
    if qian <> dianweizhi then
    begin
      {位置上的数转换成大写}
      case StrToInt(Smallmonth[qian]) of
        1: wei1 := '壹';
        2: wei1 := '贰';
        3: wei1 := '叁';
        4: wei1 := '肆';
        5: wei1 := '伍';
        6: wei1 := '陆';
        7: wei1 := '柒';
        8: wei1 := '捌';
        9: wei1 := '玖';
        0: wei1 := '零';
      end;
      {判断大写位置,可以继续增大到real类型的最大值}
      case qianwei of -3: qianwei1 := '厘'; -2: qianwei1 := '分'; -1: qianwei1 := '角';
        0: qianwei1  := '元';
        1: qianwei1  := '拾';
        2: qianwei1  := '佰';
        3: qianwei1  := '仟';
        4: qianwei1  := '万';
        5: qianwei1  := '拾';
        6: qianwei1  := '佰';
        7: qianwei1  := '仟';
        8: qianwei1  := '亿';
        9: qianwei1  := '拾';
        10: qianwei1 := '佰';
        11: qianwei1 := '仟';
      end;
      inc(qianwei);
      BigMonth := wei1 + qianwei1 + BigMonth;{组合成大写金额}
    end;
  end;  BigMonth := FastReplace(BigMonth, '零拾', '零', False);
  BigMonth := FastReplace(BigMonth, '零佰', '零', False);
  BigMonth := FastReplace(BigMonth, '零仟', '零', False);
  BigMonth := FastReplace(BigMonth, '零角零分', '', False);
  BigMonth := FastReplace(BigMonth, '零角', '零', False);
  BigMonth := FastReplace(BigMonth, '零分', '', False);
  BigMonth := FastReplace(BigMonth, '零零', '零', False);
  BigMonth := FastReplace(BigMonth, '零零', '零', False);
  BigMonth := FastReplace(BigMonth, '零零', '零', False);
  BigMonth := FastReplace(BigMonth, '零亿', '亿', False);
  BigMonth := FastReplace(BigMonth, '零万', '万', False);
  BigMonth := FastReplace(BigMonth, '零元', '元', False);
  BigMonth := FastReplace(BigMonth, '亿万', '亿', False);
  BigMonth := BigMonth + '整';
  BigMonth := FastReplace(BigMonth, '分整', '分', False);
  if BigMonth = '元整' then
    BigMonth := '零元整';
  if copy(BigMonth, 1, 2) = '元' then
    BigMonth := copy(BigMonth, 3, length(BigMonth) - 2);
  if copy(BigMonth, 1, 2) = '零' then
    BigMonth := copy(BigMonth, 3, length(BigMonth) - 2);
  if fs_bj = True then
    SmallTOBig := '- ' + BigMonth
  else
    SmallTOBig := BigMonth;
end;

解决方案 »

  1.   

    string ls_bit[18] = {'仟','佰','拾','万','仟','佰','拾','亿','仟','佰','拾','万','仟','佰','拾','元','角','分'}string ls_num[9] = {'壹','贰','叁','肆','伍','陆','柒','捌','玖'}string ls_r = '', ls_je, ls_clong i, kls_je = string( data * 100, fill( '#', 18 - 1 ) + '0' )k = 18 - len( ls_je ) + 1for i = k to 18ls_c = mid( ls_je, i - k + 1, 1 )if ls_c = '0' thenif pos( ls_bit[i - 1], '零' ) > 0 then ls_bit[i - 1] = '';if ls_bit[i] <> '亿' and ls_bit[i] <> '万' and ls_bit[i] <> '元' then ls_bit[i] = '零'elsels_bit[i] = ls_num[long(ls_c)] + ls_bit[i]end ifnextif ls_c = '0' then ls_bit[18] = '整'if ls_bit[9] = '' and ls_bit[10] = '' and ls_bit[11] = '' then ls_bit[12] = ''for i = k to 18ls_r = ls_r + ls_bit[i]nextreturn ls_r
      

  2.   

    Function XiaoxieToDaxie(f : String) : String;
    var
       Fs,dx,d2,zs,xs,h,jg:string;
       i,ws,{l,}w,j,lx:integer;
    begin
      f := Trim(f);
      if copy(f,1,1)='-' then begin
        Delete(f,1,1);fs:='负';end
      else fs:='';
      dx:='零壹贰叁肆伍陆柒捌玖';
      d2:='拾佰仟万亿';
      i := AnsiPos('.',f);   //小数点位置
      if i = 0 Then
         zs := f     //整数
      else begin
         zs:=copy(f,1,i - 1);  //整数部分
         xs:=copy(f,i + 1,200);
      end;
      ws:= 0; //l := 0;
      for i := Length(zs) downto 1 do begin
        ws := ws + 1; h := '';
        w:=strtoint(copy(zs, i, 1));
        if (w=0) and (i=1) then jg:='零';
        If w > 0 Then
           Case ws of
             2..5:h:=copy(d2,(ws-1)*2-1,2);
             6..8:begin
               h:=copy(d2,(ws-5)*2-1,2);
               If AnsiPos('万',jg)=0 Then h:=h+'万';
               end;
             10..13:h := copy(d2,(ws-9)*2-1, 2);
           End;
        jg:=copy(dx,(w+1)*2-1,2) + h + jg;
        If ws=9 Then jg := copy(jg,1,2) + '亿' + copy(jg,3,200);
      end;
      j:=AnsiPos('零零',jg);
      While j > 0 do begin
        jg := copy(jg, 1, j - 1) + copy(jg, j + 2,200);
        j := AnsiPos('零零',jg);
      end;
      If (Length(jg) > 1) And (copy(jg,length(jg)-1,2)='零') Then jg :=copy(jg,1,Length(jg)-2);
      j := AnsiPos('零亿',jg);
      If j > 0 Then jg := copy(jg,1, j - 1) + copy(jg, j + 2,200);
      //转换小数部分
      lx := Length(xs);
      If lx > 0 Then begin
        jg := jg + '元';
        For i := 1 To lx do begin
          if i=1 then begin
            jg := jg + copy(dx, strtoint(copy(xs,i,1))*2 + 1, 2);
            jg := jg +'角';
          end;
          if i=2 then begin
            jg := jg + copy(dx, strtoint(copy(xs,i,1))*2 + 1, 2);
            jg := jg +'分';
          end;
        end;
        j :=AnsiPos('零角零分',jg);
        if j>0 then jg := copy(jg,1,j-1)+copy(jg,j+8,200)+'整';
        j := AnsiPos('零角',jg);
        i:=AnsiPos('零分',jg);
        if (j>0) and (i>0) then jg := copy(jg,1,j-1)+copy(jg,j+4,200)
        else jg:= copy(jg,1,j+1)+copy(jg,j+4,200); 
      End
      else
        jg := jg + '元整';
      result := fs+jg;
    end;
      

  3.   

    Function  TFormFhdCw.XxToDx(const hjnum:real):String; 
    var Vstr,zzz,cc,cc1,Presult:string; 
        xxbb:array[1..12]of string; 
        uppna:array[0..9] of string; 
        iCount,iZero,vPoint,vdtlno:integer; 
    begin 
      //*设置大写中文数字和相应单位数组*// 
      xxbb[1]:='亿'; 
      xxbb[2]:='仟'; 
      xxbb[3]:='佰'; 
      xxbb[4]:='拾'; 
      xxbb[5]:='万'; 
      xxbb[6]:='仟'; 
      xxbb[7]:='佰'; 
      xxbb[8]:='拾'; 
      xxbb[9]:='元'; 
      xxbb[10]:='.'; 
      xxbb[11]:='角'; 
      xxbb[12]:='分'; 
      uppna[0]:='零'; 
      uppna[1]:='壹'; 
      uppna[2]:='贰'; 
      uppna[3]:='叁'; 
      uppna[4]:='肆'; 
      uppna[5]:='伍'; 
      uppna[6]:='陆'; 
      uppna[7]:='柒'; 
      uppna[8]:='捌'; 
      uppna[9]:='玖'; 
      Str(hjnum:12:2,Vstr); 
      cc:=''; 
      cc1:=''; 
      zzz:=''; 
      result:=''; 
      presult:=''; 
      iZero:=0; 
      vPoint:=0; 
      for iCount:=1 to 10 do 
        begin 
          cc:=Vstr[iCount]; 
          if cc<>' ' then 
            begin 
              zzz:=xxbb[iCount]; 
              if cc='0' then 
              begin 
                if iZero<1 then //*对“零”进行判断*// 
    cc:='零' 
    else 
    cc:=''; 
    if iCount=5 then //*对万位“零”的处理*// 
    if copy(result,length(result)-1,2)='零' then 
    result:=copy(result,1,length(result)-2)+xxbb[iCount]
    +'零' 
    else 
    result:=result+xxbb[iCount]; 
    cc1:=cc; 
    zzz:=''; 
    iZero:=iZero+1; 
    end 
    else 
    begin 
    if cc='.' then 
    begin 
    cc:=''; 
    if (cc1='') or (cc1='零') then 
    begin 
    Presult:=copy(result,1,Length(result)-2); 
    result:=Presult; 
    iZero:=15; 
    end; 
    if iZero>=1 then 
                         zzz:=xxbb[9] 
                      else 
                         zzz:=''; 
                      vPoint:=1; 
                    end 
                  else 
                    begin 
                      iZero:=0; 
                      cc:=uppna[StrToInt(cc)]; 
                    end 
                end; 
              result:=result+(cc+zzz) 
            end; 
        end; 
        If Vstr[11]='0' then   //*对小数点后两位进行处理*// 
        begin 
           if Vstr[12]<>'0' then 
           begin 
              cc:='零'; 
              result:=result+cc; 
              cc:=uppna[StrToInt(Vstr[12])]; 
              result:=result+(uppna[0]+cc+xxbb[12]); 
           end 
        end 
        else 
        begin 
           if iZero=15 then 
           begin 
              cc:='零'; 
              result:=result+cc; 
           end; 
           cc:=uppna[StrToInt(Vstr[11])]; 
           result:=result+(cc+xxbb[11]); 
           if Vstr[12]<>'0' then 
           begin 
              cc:=uppna[StrToInt(Vstr[12])]; 
              result:=result+(cc+xxbb[12]); 
           end; 
        end; 
      result:=result+'正'; 
    end; 
      

  4.   

    http://www.csdn.net/expert/topic/458/458876.xml?temp=.6569178
    http://www.csdn.net/expert/topic/229/229406.xml?temp=6.588161E-03
    http://www.csdn.net/expert/topic/306/306772.xml?temp=.3519861
    http://www.csdn.net/expert/topic/427/427440.xml?temp=.5346643
    老大,查一下
    有一大车
      

  5.   

    怎么不搜索一下先,下面是程序员大本营上的一篇,呵呵function Tform1.SmallTOBig(small:real):string;
    var SmallMonth,BigMonth:string;
        wei1,qianwei1:string[2];
        qianwei,dianweizhi,qian:integer;
    begin
       {------- 修改参数令值更精确 -------}
       {小数点后的位置,需要的话也可以改动-2值}
       qianwei:=-2;
       {转换成货币形式,需要的话小数点后加多几个零}
       Smallmonth:=formatfloat('0.00',small);
       {---------------------------------}
       dianweizhi :=pos('.',Smallmonth);{小数点的位置}
       {循环小写货币的每一位,从小写的右边位置到左边}
       for qian:=length(Smallmonth) downto 1 do
       begin
         {如果读到的不是小数点就继续}
         if qian<>dianweizhi then
         begin
         {位置上的数转换成大写}
            case strtoint(copy(Smallmonth,qian,1)) of
              1:wei1:='壹'; 2:wei1:='贰';
              3:wei1:='叁'; 4:wei1:='肆';
              5:wei1:='伍'; 6:wei1:='陆';
              7:wei1:='柒'; 8:wei1:='捌';
              9:wei1:='玖'; 0:wei1:='零';
            end;
            {判断大写位置,可以继续增大到real类型的最大值}
            case qianwei of
              -3:qianwei1:='厘';
              -2:qianwei1:='分';
              -1:qianwei1:='角';
              0 :qianwei1:='元';
              1 :qianwei1:='拾';
              2 :qianwei1:='佰';
              3 :qianwei1:='千';
              4 :qianwei1:='万';
              5 :qianwei1:='拾';
              6 :qianwei1:='佰';
              7 :qianwei1:='千';
              8 :qianwei1:='亿';
              9 :qianwei1:='十';
              10:qianwei1:='佰';
              11:qianwei1:='千';
            end;
            inc(qianwei);
            BigMonth :=wei1+qianwei1+BigMonth;{组合成大写金额}
          end;
       end;
       SmallTOBig:=BigMonth;
    end;调用如下“edit1.text:=SmallTOBig(1234567890.1234);”他自动默认小数点后两位