主题:  如何让数字自动大写显示.

孤月寒星

职务:普通成员
等级:1
金币:1.0
发贴:189
#12003/9/12 8:45:04
比如1,2,3......21,.... 自动转换成一,二,三,.......二十一,......



janlay

职务:管理员
等级:7
金币:28.0
发贴:7244
#22003/9/12 9:45:47
根据数值的位数产生对应的大写位,注意零的处理。算法不是很复杂,自己动脑筋想一下,也是一个锻炼机会



风之翅

职务:普通成员
等级:2
金币:10.0
发贴:540
#32003/9/12 21:47:48
Function china(str)
dim nub,mystr
nub = Len(str)
mystr = ""
For i = 1 To nub
Select Case i
Case 2
mystr = "十"&mystr
Case 3
mystr = "百"&mystr
Case 4
mystr = "千"&mystr
End Select
mystr = Left(Right(str,i),1)&mystr
mystr = Replace(mystr,0,"零")
mystr = Replace(mystr,1,"一")
mystr = Replace(mystr,2,"二")
mystr = Replace(mystr,3,"三")
mystr = Replace(mystr,4,"四")
mystr = Replace(mystr,5,"五")
mystr = Replace(mystr,6,"六")
mystr = Replace(mystr,7,"七")
mystr = Replace(mystr,8,"八")
mystr = Replace(mystr,9,"九")
Next
mystr = Replace(mystr,"零百零十零","")
mystr = Replace(mystr,"零百零十","零")
mystr = Replace(mystr,"零百","零")
mystr = Replace(mystr,"零十零","")
mystr = Replace(mystr,"零十","零")
mystr = Replace(mystr,"十零","十")
china = mystr
End Function
---------------------------------------------------------------
限于0-9999,后面去零的代码太伤脑筋
china(9999)