Sub Hexa2Decimal (sNumber As String) As Int
' Dim BC As ByteConverter
' 'Log($"Value ${BC.IntsFromBytes(BC.HexToBytes(sNumber.Replace("0x", "00000")))(0)}"$) ' 1046
' Return BC.IntsFromBytes(BC.HexToBytes(sNumber.Replace("0x", "00000")))(0)
Dim i, k As Int = 0
Dim iSuma As Int = 0
Dim sCar As String
Dim iBase As Int = 1
If sNumber.Contains("h") Then
sNumber = sNumber.SubString2(0,sNumber.Length-1)
End If
If sNumber.Contains("0x") Then
sNumber = sNumber.SubString(3)
End If
For i = sNumber.Length -1 To 0 Step -1
sCar = sNumber.CharAt(i)
Select sCar
Case "A", "a"
sCar = "10"
Case "B", "b"
sCar = "11"
Case "C", "c"
sCar = "12"
Case "D", "d"
sCar = "13"
Case "E", "e"
sCar = "14"
Case "F", "f"
sCar = "15"
End Select
'If k = 0 Then iBase = 1
If k = 1 Then iBase = 16
If k = 2 Then iBase = 256
If k = 3 Then iBase = 4096
If k = 4 Then iBase = 65536
If k = 5 Then iBase = 1048576
iSuma = iSuma + (sCar * iBase)
k = k + 1
Next
Return iSuma
End Sub