数字转换成英文数字

xcg992224 2007-12-20 03:30:16
数字转换成英文数字
...全文
281 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ling81327 2007-12-22
  • 打赏
  • 举报
回复
20分太少了 我从来都是不下50分
wangxuelid 2007-12-21
  • 打赏
  • 举报
回复
牛人,,,
hongqi162 2007-12-21
  • 打赏
  • 举报
回复
function convert(lcnum:string):string;   
type
arr=array[1..9,1..3] of string;
var
num:arr;
lclast,temp:string;
i,code,len,lntimes,lnhundred,lnten,lnone,lntempnum:integer;
begin
lntimes:=0;
lclast:='';
num[1,1]:='ONE';
num[1,2]:='ELEVEN';
num[1,3]:='TEN';
num[2,1]:='TWO';
num[2,2]:='TWELVE';
num[2,3]:='TWENTY';
num[3,1]:='THREE';
num[3,2]:='THIRTEEN';
num[3,3]:='THIRTY';
num[4,1]:='FOUR';
num[4,2]:='FOURTEEN';
num[4,3]:='FORTY';
num[5,1]:='FIVE';
num[5,2]:='FIFTEEN';
num[5,3]:='FIFTY';
num[6,1]:='SIX';
num[6,2]:='SIXTEEN';
num[6,3]:='SIXTY';
num[7,1]:='SEVEN';
num[7,2]:='SEVENTEEN';
num[7,3]:='SEVENTY';
num[8,1]:='EIGHT';
num[8,2]:='EIGHTEEN';
num[8,3]:='EIGHTY';
num[9,1]:='NINE';
num[9,2]:='NINETEEN';
num[9,3]:='NINETY';
len:=length(lcnum);
for i:=1 to 12-len do
lcnum:=concat('0',lcnum);
for i:=0 to 3 do
begin
temp:=copy(lcnum,1+3*i,3);
val(temp,lntempnum,code);
lntimes:=lntimes+1;
if lntempnum=0 then
continue;
lnhundred:=lntempnum div 100;
lnten:=(lntempnum div 10) mod 10;
lnone:=lntempnum mod 10;
if lnhundred<>0 then
lclast:=concat(lclast,' ',num[lnhundred,1],' HUNDRED');
if (length(trim(lclast))<>0) and (lnhundred<>0) then
lclast:=concat(lclast,' AND');
if (lntimes=4) and (lnhundred=0) and (length(trim(lclast))<>0) then
lclast:=concat(lclast,' AND');
case lnten of
0:
begin
if lnone<>0 then
lclast:=concat(lclast,' ',num[lnone,1])
else
begin
temp:=copy(lclast,length(lclast)-2,3);
if temp='AND' then
lclast:=copy(lclast,1,length(lclast)-3);
end;//case 0 else
end;//case 0
1:
begin
if lnone<>0 then
lclast:=concat(lclast,' ',num[lnone,2])
else
lclast:=concat(lclast,' ',num[1,3]);
end;//case 1
else
if lnone<>0 then
lclast:=concat(lclast,' ',num[lnten,3],'-',num[lnone,1])
else
lclast:=concat(lclast,' ',num[lnten,3]);
end;//case1
case lntimes of
1:lclast:=concat(lclast,' BILLION');
2:lclast:=concat(lclast,' MILLION');
3:lclast:=concat(lclast,' THOUSAND');
end;//case2
end;//for
result:=lclast;
end;
zwsnut 2007-12-21
  • 打赏
  • 举报
回复
狂汗,编翻译软件啊
xionw 2007-12-20
  • 打赏
  • 举报
回复
参观学习
wangxuelid 2007-12-20
  • 打赏
  • 举报
回复
我只会替换的形式
1: one
2: two
*****
10 : ten
其它不会
关注,,
brightyang 2007-12-20
  • 打赏
  • 举报
回复
期待高手
brightyang 2007-12-20
  • 打赏
  • 举报
回复
upupup,期待高手进来
brightyang 2007-12-20
  • 打赏
  • 举报
回复
期待高手

2,495

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧