|
发表于 2010-3-14 23:32:25
|
显示全部楼层
$iDec = 17
$iOct = StringFormat("%o", $iDec); <== Conversion Dec 2 Oct
$iOct2Hex = Hex(Oct2Dec($iOct), 6) ; <== Conversion Oct 2 Hex
MsgBox(0, "Decimal2Oct", "Decimal " & "= " & $iDec & @CRLF & _
"Hexidecimal " & "= " & "0x" & Hex($iDec, 6) & @CRLF & _
"Octal " & "= " & $iOct & @CRLF & _
"Oct2Hex " & "= " & "0x" & $iOct2Hex)
;
Func Oct2Dec($iN)
Local $aN, $iOct = 0
$aN = StringSplit($iN, "", 1)
For $x = 1 To UBound($aN) - 1
$iOct += $aN[$x] * (8 ^ (UBound($aN) - 1 - $x))
Next
Return $iOct
EndFunc ;==>Oct2Dec
自己转转看就知道了 |
|