📄 china.prg
字号:
Parameter a
b=China(a)
return Allt(b)
Set Talk on
Function China
Parameter nxx
Release xh,xw,wbly,tempxx,bn
Public xh,xw,wbly,tempxx,bn
Tempxx="0"
g=""
nxx=Round(nxx,2) &&小数后二位处四舍五入
If nxx<100000000
xh=Allt(Str(Int(nxx))) &&取整后转换为字符串
Else
xuwei=Int(nxx/100000000) &&除以一亿 以取搞定科学数法
If nxx-xuwei*100000000=0 &&切取后8位字符
tempxx="00000000" &&搞定后面全是0的
Else
tempxx=allt(Str(nxx-xuwei*100000000)) &&
If Len(tempxx)<>8
bn=8-Len(tempxx)
For i=1 To bn
tempxx="0"+tempxx
EndFor
Endif
Endif
xh=Allt(Str(xuwei))+tempxx
EndIf
xw=Right(Allt(Str((nxx-Int(nxx)+1)*100)),2)
public array NtoC[10,2]
stor '1' to ntoc[1,1]
stor '壹' to ntoc[1,2]
stor '2' to ntoc[2,1]
stor '贰' to ntoc[2,2]
stor '3' to ntoc[3,1]
stor '叁' to ntoc[3,2]
stor '4' to ntoc[4,1]
stor '肆' to ntoc[4,2]
stor '5' to ntoc[5,1]
stor '伍' to ntoc[5,2]
stor '6' to ntoc[6,1]
stor '陆' to ntoc[6,2]
stor '7' to ntoc[7,1]
stor '柒' to ntoc[7,2]
stor '8' to ntoc[8,1]
stor '捌' to ntoc[8,2]
stor '9' to ntoc[9,1]
stor '玖' to ntoc[9,2]
stor '0' to ntoc[10,1]
stor '零' to ntoc[10,2]
If Allt(xh)#'0'
NZ=len(ALLT(xh))
For i=1 To NZ
NtoC_C=Left(right(xh,i),1)
b=AScan(NtoC,NtoC_C)
If b#0
h=Asubscript(Ntoc,b,1)
c=Ntoc[h,2]
If i<6
e=i%5
Do Case
Case e=1
f=Space(0)
Case e=2
f="拾"
Case e=3
f="佰"
Case e=4
f="仟"
Case e=0
f="万"
EndCase
Else
e=i%4
Do Case
Case e=1
f="亿"
Case e=2
f="拾"
Case e=3
f="佰"
Case e=0
f="仟"
EndCase
EndIf
&&&&&&&&&&&&&&&&&&对零处理 Start.&&&&&&&&&&&&&&&&&&
If Allt(c)='零'
FTEMP=F
F=SPACE(0)
If Subst(g,1,2)="零" OR Subst(g,1,2)='万' OR Subst(g,1,2)="亿"
c=Space(0)
f=Space(0)
Endif
If i=5
C=Space(0)
If Subst(g,1,2)<>"零"
F=FTEMP+"零"
Else
F=FTEMP
Endif
Endif
If i=9
C=Space(0)
If Substr(g,1,2)="万"
GTEMP=Right(g,Len(Alltrim(G))-2)
G=GTEMP
EndIf
If Substr(g,1,2)#"零"
F=FTEMP+"零"
Else
F=FTEMP
EndIf
EndIf
Else
If i=9 .and. Substr(g,1,2)="万"
GTEMP=Right(g,Len(Alltrim(G))-2)
G=GTEMP
EndIf
Endif
&&&&&&&&&&&&&&&&&&对零处理 END.&&&&&&&&&&&&&&&&&&&&&
g=Allt(c)+Allt(f)+g
EndIf
EndFor
EndIf
If len(g)>0
g=IIf(right(g,2)='零',left(g,len(g)-2),g)
g=g+"元"
EndIf
z=''
For s=1 to Len(Alltrim(xw))
p=subst(xw,s,1)
j=AScan(NtoC,p)
h=Asubscript(Ntoc,j,1)
If j<>0
If s=1
d=NtoC[h,2]+"角"
Else
d=NtoC[h,2]+"分"
EndIf
d=IIf(left(d,2)#'零',d,Space(0))
EndIf
z=z+allt(d)
EndFor
z=g+z+"整"
If Alltrim(z)='整'
z='零元零角零分整'
EndIf
Return z
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -