• 主页
• API 调用
• 基础类
• 控件与界面
• 数据库相关
• DataWindow
• 项目管理
• Web 应用
• 脚本语言

# 如何把数字(currency)转化成大写的汉字串

hong99 2003-12-11 09:14:42

...全文
9 点赞 收藏 8

8 条回复

banalman 2003-12-18

int i,li_lendec,li_lenint
int li_amout_flag
string ls_numstr,a,b,c,d,bbak
string ls_dxint[13],ls_dxdec[2],ls_sz[13]
string ls_dxstr="万仟佰拾亿仟佰拾万仟佰拾元"
string ls_szstr="零壹贰叁肆伍陆柒捌玖"
string return_value

li_amout_flag = 1
end if

li_lenint=len(mid(ls_numstr,1,pos(ls_numstr,'.') - 1))
//messagebox('',li_lenint)
/*if right(ls_numstr,2)='00' then
li_lendec=0
else*/
// li_lendec=2
//end if

for i=1 to 13
ls_dxint[i]=mid(ls_dxstr,26 - i*2+1,2)
if i<11 then
ls_sz[i]=mid(ls_szstr,i*2 - 1,2)
else
ls_sz[i]=" "
end if
next
ls_dxdec[1]="角"
ls_dxdec[2]="分"
ls_dxstr=" "

for i = 1 to li_lenint
a = mid(mid(ls_numstr,1,li_lenint),i,1)
b = ls_sz[integer(a)+1]
c = ls_dxint[li_lenint - i +1]
/*if ls_dxstr<>" " then
d = mid(ls_dxstr,len(ls_dxstr) - 1 ,2)
else
d = " "
end if
if b="零" and (d="零" or b=bbak or c="元" or c="万" or c="亿") then b=""
if a="0" and c<>"元" and c<>"万" and c<>"亿" then c=""
if (c="元" or c="万" or c="亿") and d="零" and a="0" then
ls_dxstr=mid(ls_dxstr,1,len(ls_dxstr) - 2)
d = mid(ls_dxstr,len(ls_dxstr) - 1,2)
if (c="元" and d="万" or c="万"and d="亿") then c=""
end if*/
ls_dxstr=ls_dxstr + b + c
//bbak = b
next
//messagebox('',ls_dxstr)
for i=1 to 2
a = mid (mid(ls_numstr,li_lenint+2,2),i,1)
b=ls_sz[integer(a) + 1]
ls_dxstr=ls_dxstr+b+ls_dxdec[i]
next
ls_dxstr="￥￥"+trim(ls_dxstr)

if position > len(ls_dxstr) then
return return_value
else
return_value=left(right(ls_dxstr,position),2)
end if

return return_value

poemlake 2003-12-11

//------------------------------------------------//
// 将金额转为大写
//------------------------------------------------//

int i,li_lendec,li_lenint
int li_amout_flag
string ls_numstr,a,b,c,d,bbak
string ls_dxint[13],ls_dxdec[2],ls_sz[13]
string ls_dxstr="万仟佰拾亿仟佰拾万仟佰拾元"
string ls_szstr="零壹贰叁肆伍陆柒捌玖"
string return_value

li_amout_flag = 1
end if

li_lenint=len(mid(ls_numstr,1,pos(ls_numstr,'.') - 1))
//messagebox('',li_lenint)
/*if right(ls_numstr,2)='00' then
li_lendec=0
else*/
// li_lendec=2
//end if

for i=1 to 13
ls_dxint[i]=mid(ls_dxstr,26 - i*2+1,2)
if i<11 then
ls_sz[i]=mid(ls_szstr,i*2 - 1,2)
else
ls_sz[i]=" "
end if
next
ls_dxdec[1]="角"
ls_dxdec[2]="分"
ls_dxstr=" "

for i = 1 to li_lenint
a = mid(mid(ls_numstr,1,li_lenint),i,1)
b = ls_sz[integer(a)+1]
c = ls_dxint[li_lenint - i +1]
/*if ls_dxstr<>" " then
d = mid(ls_dxstr,len(ls_dxstr) - 1 ,2)
else
d = " "
end if
if b="零" and (d="零" or b=bbak or c="元" or c="万" or c="亿") then b=""
if a="0" and c<>"元" and c<>"万" and c<>"亿" then c=""
if (c="元" or c="万" or c="亿") and d="零" and a="0" then
ls_dxstr=mid(ls_dxstr,1,len(ls_dxstr) - 2)
d = mid(ls_dxstr,len(ls_dxstr) - 1,2)
if (c="元" and d="万" or c="万"and d="亿") then c=""
end if*/
ls_dxstr=ls_dxstr + b + c
//bbak = b
next
//messagebox('',ls_dxstr)
for i=1 to 2
a = mid (mid(ls_numstr,li_lenint+2,2),i,1)
b=ls_sz[integer(a) + 1]
ls_dxstr=ls_dxstr+b+ls_dxdec[i]
next
ls_dxstr="￥￥"+trim(ls_dxstr)

if position > len(ls_dxstr) then
return return_value
else
return_value=left(right(ls_dxstr,position),2)
end if

return return_value

bunnysky 2003-12-11
UP

TGWall 2003-12-11

http://expert.csdn.net/Expert/topic/2148/2148196.xml?temp=.4854853

intuition444 2003-12-11

sundayblue 2003-12-11

intuition444 2003-12-11

hong99 2003-12-11
intuition444(直觉):我的邮箱是:hong_ley@163.com

PowerBuilder

812

PowerBuilder 相关问题讨论