二、中文大写转换
以下是进行中文大写转换的函数内容,函数名为dtormb:
decimal y
string je,x,hz1,hz2,e,h,f,m
int b,a
y=mje
X = trim(string(Y))
B = len(X)-3
A = 1
E = mid(X,A,1)
HZ2 = '零壹贰叁肆伍陆柒捌玖'
HZ1 = '仟佰拾亿仟佰拾万仟佰拾元'
JE = ' '
do while E< >'.'
H = mid(HZ2,integer(E)*2+1,2)
F = mid(HZ1,24 - (B - A)*2 - 1,2)
if E< >'0' or (E='0' and (F='亿' or F='万' or F='元')) then
JE = trim(JE)+H+F
else
JE = trim(JE)+H
end if
A = A+1
E = mid(X,A,1)
loop
A = A+1
E = mid(X,A,1)
H = mid(X,A+1,1)
if E='0' and H='0' then
JE = JE+'整'
else
if E='0' then
JE = JE+'零'+mid(HZ2,integer(H)*2+1,2)+'分'
else
if H='0' then
JE = JE+mid(HZ2,integer(E)*2+1,2)+'角整'
else
JE = JE+mid(HZ2,integer(E)*2+1,2)
+'角'+mid(HZ2,integer(H)*2+1,2)+'分'
end if
end if
end if
B = len(JE)
A = 1
do while A< B
M = mid(JE,A,4)
if M='零元' or M='零万' or M='零亿' or M='零零' then
JE = mid(JE,1,A - 1)+trim(mid(JE,A+2,40))
A = A - 2
B = B - 2
end if
A = A+2
loop
return JE
文章来源于领测软件测试网 https://www.ltesting.net/