Hex 2 Num
BlitzPlus Forums/BlitzPlus Programming/Hex 2 Num
| ||
Can someone write a func that converts hex to a regular number, esp., if possible, one that works with those rather strange hex-values used in VisualBasic colors, (from numb to vb-hex too, please).. |
| ||
Hi had this laying around, might be of some use. Has my strange coding style written all over it. There is probably a better way. [Code]Function Dec(HexVal$) For t=Len(HexVal) To 1 Step -1 chk$=Mid(HexVal,t,1) If Chk$<>"0" Val=chk$ If Val=0 Val=Asc(Chk)-55 EndIf Else Val=0 EndIf If Count=0 Decimal=Decimal+Val Else Decimal=Decimal+(Val*(16^Count)) EndIf Count=Count+1 Next Return Decimal End Function[/code] |
| ||
OK.. Thanx. |
| ||
did u know you can use hex values in blitz ie: local = $ff v is now equal to 255 |