- UID
- 2
注册时间2004-12-1
阅读权限255
最后登录1970-1-1
总坛主
TA的每日心情 | 开心 2024-12-1 11:04 |
---|
签到天数: 12 天 [LV.3]偶尔看看II
|
发表于 2007-5-20 21:52:26
|
显示全部楼层
需要处理大数
- Private Sub Command1_Click()
- test = dectohex(3032215713#)
- MsgBox test'结果为:B4BBF0A1
- End Sub
- '***************************************************************
- '函数名称:10-->16进制转换
- '***************************************************************
- Function dectohex(ByVal hugenum As String) As String
- Do While Len(hugenum) > 2
- dectohex = Hex(Val(Right(hugenum, 4)) Mod 16) & dectohex
- For I = 1 To 4
- hugenum = half(hugenum)
- Next
- Loop
- dectohex = Hex(Val(hugenum)) & dectohex
- End Function
- '***************************************************************
- '函数名称:取半
- '***************************************************************
- Function half(ByVal X As String) As String '
- X = 0 & X
- Dim I As Long
- ReDim result(2 To Len(X)) As String
- For I = 2 To Len(X)
- result(I) = CStr(Val(Mid(X, I, 1)) \ 2 + IIf(Val(Mid(X, I - 1, 1)) Mod 2 = 1, 5, 0))
- Next
- half = Join(result, "")
- If Left(half, 1) = "0" Then half = Right(half, Len(half) - 1)
- End Function
复制代码 |
|