function SmallToBig(Mon:Real):string; //小写金额转为大写金额 function SmallToBig(Mon:Real):string; var Qianwei,Dotpos,i,j: integer; Small,Wei1,Qianwei1: string; stail : string; ZeroNumber: integer; begin Result := ''; small:=FormatFloat('0.00',Mon); DotPos:=pos('.',small); for j:=length(small) downto 1 do begin if j<>dotpos then begin if StrToint(copy(small,j,1))<>0 then Break; end; end;
qianwei := length(small)-j-3; if qianwei<0 then qianwei := qianwei +1; if qianwei>4 then Stail := '万' else if (qianwei>0)and (qianwei<=4) then Stail := '' else Stail := ''; ZeroNumber := 0; for i:=j downto 1 do begin if i<>dotpos then begin if (ZeroNumber >0) and (StrToInt(copy(small,i,1))=0) then inc(qianwei) else begin case StrToInt(copy(small,i,1)) of 1:wei1:='壹'; 2:wei1:='贰'; 3:wei1:='叁'; 4:wei1:='肆'; 5:wei1:='伍'; 6:wei1:='陆'; 7:wei1:='柒'; 8:wei1:='捌'; 9:wei1:='玖'; 0:wei1:='零'; end; if wei1<>'零' then begin 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; end else qianwei1 :=''; inc(qianwei); Result:=wei1+qianwei1+Result; if strtoint(copy(small,i,1))=0 then ZeroNumber := ZeroNumber +1 else ZeroNumber := 0; end; end; end; Result := Result + Stail; end;
----------------------------------------------
代码世界不仅仅只有键盘的声响,还有我们热切的心! 有我们共同的世界和共同的目标,也是程序员的目标!
//汉字-拼音缩写 [mode = 1] Upper(),[Mode = 2] Lowwer() function GetPinYin(sHZ: string;mode: integer = 1): string; var i: Integer; PY: string; s: string; function GetPYIndexChar(hzchar: string): char; begin case WORD(hzchar[1]) shl 8 + WORD(hzchar[2]) of $B0A1..$B0C4: result := 'a'; $B0C5..$B2C0: result := 'b'; $B2C1..$B4ED: result := 'c'; $B4EE..$B6E9: result := 'd'; $B6EA..$B7A1: result := 'e'; $B7A2..$B8C0: result := 'f'; $B8C1..$B9FD: result := 'g'; $B9FE..$BBF6: result := 'h'; $BBF7..$BFA5: result := 'j'; $BFA6..$C0AB: result := 'k'; $C0AC..$C2E7: result := 'l'; $C2E8..$C4C2: result := 'm'; $C4C3..$C5B5: result := 'n'; $C5B6..$C5BD: result := 'o'; $C5BE..$C6D9: result := 'p'; $C6DA..$C8BA: result := 'q'; $C8BB..$C8F5: result := 'r'; $C8F6..$CBF9: result := 's'; $CBFA..$CDD9: result := 't'; $CDDA..$CEF3: result := 'w'; $CEF4..$D188: result := 'x'; $D1B9..$D4D0: result := 'y'; $D4D1..$D7F9: result := 'z'; else result := char(32); end; end; begin s := ''; i := 1; while i <= Length(sHZ) do begin PY := Copy(sHZ, i, 1); if PY >= Chr(128) then begin Inc(i); PY := PY + Copy(sHZ, i, 1); s := s + GetPYIndexChar(PY); end else s := s + PY; Inc(i); end; case mode of 1: result := UpperCase(s); 2: result := LowerCase(s); else result := s; end; //case end;
----------------------------------------------