能按上数读法读数字大写的VB函数,ChineseNumber("1"&REPT("0",127)),结果是“壹仟万亿兆京垓”。个人认为,读懂本函数的算法,对于理解递归和分治法有好处。Function ChineseNumber(Number) ChineseNumber = "" Dim DigitName(9),SubBaseName(4),BaseName(4) DigitName(0) = "零" DigitName(1) = "壹" DigitName(2) = "贰" DigitName(3) = "叁" DigitName(4) = "肆" DigitName(5) = "伍" DigitName(6) = "陆" DigitName(7) = "柒" DigitName(8) = "捌" DigitName(9) = "玖" SubBaseName(1) = "拾" SubBaseName(2) = "佰" SubBaseName(3) = "仟" BaseName(0) = "万" BaseName(1) = "亿" BaseName(2) = "兆" BaseName(3) = "京" BaseName(4) = "垓" Dim Length,BaseLevel,Point Dim LeftLength,RightLength Dim LeftStr,RightStr Dim iCount,Char Length = Len(Number) If Length < 5 Then For iCount = 1 To Length Char = (Mid(Number,iCount,1)) If Char <> "0" Then Point = Length - iCount ChineseNumber = ChineseNumber + DigitName(Val(Char)) + SubBaseName(Point) If Point <> 0 Then If Mid(Number,iCount + 1,1) = "0" Then If Right(Number,Point) <> String(Point,"0") Then ChineseNumber = ChineseNumber + DigitName(0) End If End If End If End If Next Else BaseLevel = Int(Log(Int((Length - 1) / 4)) / Log(2)) RightLength = 2 ^ BaseLevel * 4 LeftLength = Length - RightLength LeftStr = ChineseNumber(Left(Number,LeftLength)) RightStr = ChineseNumber(Right(Number,RightLength)) If LeftStr <> "" Then ChineseNumber = ChineseNumber + LeftStr + BaseName(BaseLevel) If (Mid(Number,LeftLength + 1,1) = "0" Or Mid(Number,LeftLength,1) = "0") And RightStr <> "" Then ChineseNumber = ChineseNumber + DigitName(0) End If End If ChineseNumber = ChineseNumber + RightStr End If End Function