Function NtoC( n0 :real) :String; Function IIF( b :boolean; s1,s2 :string) :string; begin if b then IIF:= s1 else IIF:=s2; end; //本函数的功能一目了然: 当b为真时返回s1,否则返回s2 Const c= '零壹贰叁肆伍陆柒捌玖◇分角圆拾佰仟万拾佰仟亿拾佰仟万'; var L,i,n :integer; Z :boolean; s,s1,s2 :string; begin s:= FormatFloat( '0.00', ABS(n0)); L:= Length( s); Z:= n0<1; For i:= 1 To L-3 do begin n:= StrToInt( s[ L-i-2]); s1:=IIf((n=0)And(Z Or (i=9) Or (i=5) Or (i=1)), '', Copy( c, n*2+1, 2)) + IIf((n=0)And((i<>9)And(i<>5)And(i<>1) Or Z And(i=1)),'',Copy(c,(i+13)*2-1,2)) + s1; Z:= (n=0); end; Z:= False; For i:= 1 To 2 do begin n:= StrToInt( s[ L-i+1]); s2:= IIf((n=0)And((i=1) Or (i=2)And(Z Or (n0<1))), '', Copy( c, n*2+1, 2)) + IIf( (n>0), Copy( c,(i+11)*2-1, 2), IIf( (i=2) Or Z, '','整')) + s2; Z:= (n=0); end; For i:= 1 To Length( s1) do If Copy(s1, i, 4) = '亿万' Then Delete(s1,i+2,2); NtoC:= IIf(n0=0, '零', IIF(n0<0, '-','')+ s1+s2);
//返加人民币的中文数值 function fucCapYuan(NN:double):string; var HZ,NS,NW,NA,N1,N2:string; LA,X,Nk:integer; begin if NN>9999999999999.99 then begin Msgbox('金额溢出。','出错',MB_OK + MB_ICONSTOP); HZ:=''; Result:=HZ; exit; end; if NN=0 then begin HZ:='零元'; result:=HZ; exit; end; NS:='零壹贰叁肆伍陆柒捌玖'; NW:='分角元拾佰仟万拾佰仟亿拾佰仟万'; NA:=FloatToStr(NN*100); LA:=length(NA); X:=1; HZ:=''; while X<=LA do begin NK:=Ord(NA[x])-Ord('0'); N1:=Copy(NS,NK*2+1,2); N2:=Copy(NW,LA*2+1-X*2,2); if (NK=0) AND ((N2='亿') OR( N2='万') OR( N2='元'))then begin if copy(HZ,Length(HZ)-1,2)='零' then HZ:=copy(HZ,1,length(HZ)-2); if copy(HZ,Length(HZ)-1,2)='亿' then if N2='元' then begin N1:=N2; N2:='零'; end else N2:='' else begin N1:=N2; N2:='零'; end end else if NK=0 then begin if copy(HZ,length(HZ)-1,2)='零' then N1:=''; if N2='分' then begin if copy(HZ,length(HZ)-1,2)='零' then HZ:=copy(HZ,1,length(HZ)-2)+'整' else HZ:=HZ+'整'; N1:=''; end; N2:=''; end; HZ:=HZ+N1+N2; X:=X+1 end; Result:=HZ; end;
Function IIF( b :boolean; s1,s2 :string) :string;
begin
if b then
IIF:= s1
else
IIF:=s2;
end; //本函数的功能一目了然: 当b为真时返回s1,否则返回s2
Const c= '零壹贰叁肆伍陆柒捌玖◇分角圆拾佰仟万拾佰仟亿拾佰仟万';
var L,i,n :integer;
Z :boolean;
s,s1,s2 :string;
begin
s:= FormatFloat( '0.00', ABS(n0));
L:= Length( s);
Z:= n0<1;
For i:= 1 To L-3 do
begin
n:= StrToInt( s[ L-i-2]);
s1:=IIf((n=0)And(Z Or (i=9) Or (i=5) Or (i=1)), '', Copy( c, n*2+1, 2))
+ IIf((n=0)And((i<>9)And(i<>5)And(i<>1) Or Z And(i=1)),'',Copy(c,(i+13)*2-1,2))
+ s1;
Z:= (n=0);
end;
Z:= False;
For i:= 1 To 2 do
begin
n:= StrToInt( s[ L-i+1]);
s2:= IIf((n=0)And((i=1) Or (i=2)And(Z Or (n0<1))), '', Copy( c, n*2+1, 2))
+ IIf( (n>0), Copy( c,(i+11)*2-1, 2), IIf( (i=2) Or Z, '','整'))
+ s2;
Z:= (n=0);
end;
For i:= 1 To Length( s1) do If Copy(s1, i, 4) = '亿万' Then Delete(s1,i+2,2);
NtoC:= IIf(n0=0, '零', IIF(n0<0, '-','')+ s1+s2);
function fucCapYuan(NN:double):string;
var
HZ,NS,NW,NA,N1,N2:string;
LA,X,Nk:integer;
begin
if NN>9999999999999.99 then
begin
Msgbox('金额溢出。','出错',MB_OK + MB_ICONSTOP);
HZ:='';
Result:=HZ;
exit;
end;
if NN=0 then
begin
HZ:='零元';
result:=HZ;
exit;
end;
NS:='零壹贰叁肆伍陆柒捌玖';
NW:='分角元拾佰仟万拾佰仟亿拾佰仟万';
NA:=FloatToStr(NN*100);
LA:=length(NA);
X:=1;
HZ:='';
while X<=LA do
begin
NK:=Ord(NA[x])-Ord('0');
N1:=Copy(NS,NK*2+1,2);
N2:=Copy(NW,LA*2+1-X*2,2);
if (NK=0) AND ((N2='亿') OR( N2='万') OR( N2='元'))then
begin
if copy(HZ,Length(HZ)-1,2)='零' then
HZ:=copy(HZ,1,length(HZ)-2);
if copy(HZ,Length(HZ)-1,2)='亿' then
if N2='元' then
begin
N1:=N2;
N2:='零';
end
else
N2:=''
else
begin
N1:=N2;
N2:='零';
end
end
else if NK=0 then
begin
if copy(HZ,length(HZ)-1,2)='零' then
N1:='';
if N2='分' then
begin
if copy(HZ,length(HZ)-1,2)='零' then
HZ:=copy(HZ,1,length(HZ)-2)+'整'
else
HZ:=HZ+'整';
N1:='';
end;
N2:='';
end;
HZ:=HZ+N1+N2;
X:=X+1
end;
Result:=HZ;
end;
转换为小写:lowercase(str);
AnsiUpperCase 将字串内容转为大写。function AnsiUpperCase(const S: string): string;
LowerCase 将字串转成小写。function LowerCase(const S: string): string;
Uppercase 将字串转成大写。function UpperCase(const S: string): string;
可能楼主不是这个意思,但是贴出来大家看看也是好的^o^
结果为: A
showmessage(lowercase('A'));
结果为: a