Func _NTo10($iValue, $iHex);将$iHex(<=36)进制数$iValue转换为10进制数
Local Const $KEY = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-+@"
Local $iValueLen = StringLen($iValue), $sResult
If $iHex < 2 Or $iHex > StringLen($KEY) Then
Return SetError(1, 0, "")
EndIf
For $i = 1 To $iValueLen
$sResult+=(StringInStr($KEY, StringMid($iValue, $i, 1),1)-1)* ($iHex^($iValueLen-$i))
Next
Return $sResult
EndFunc ;==>_N2Dec
Func _10ToN($iValue, $iHex);将10进制数$iValue转换为$iHex(<=36)数
If $iHex < 2 Or $iHex > 65 Then
Return SetError(1, 0, "")
EndIf
Local Const $KEY = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-+@"
Local $iMod, $sResult
While $iValue
$iMod = Mod($iValue, $iHex)
$sResult = StringMid($KEY, $iMod + 1, 1) & $sResult
$iValue = Int($iValue / $iHex)
WEnd
;Return StringFormat("(%d)%s", $iHex, $sResult)
Return $sResult
EndFunc
我知道这个UDF好使,其它方法自行查看帮助... |