Italian Hex a Int

Fulvio75

Well-Known Member
Licensed User
Ciao,

B4X:
private Sub HEXtoINT(HEX As String) As Int
    
    Dim Conv As ByteConverter
    Dim Value() As Byte
    
    Value = Conv.HexToBytes(HEX)
    
    Return Value(0)
    
'    Dim Conv As ByteConverter
'    Dim Value() As Int
'   
'    Value = Conv.IntsFromBytes(Conv.HexToBytes(HEX))
'   
'    Return Value(0)
    
End Sub

ho un problema con questo codice, passo come HEX 2C e con la parte non commentata restituisce 44 quindi giusto, perchè se uso la commentata che dovrebbe essere più giusta non mi da nulla?
 

Daestrum

Expert
Licensed User
Longtime User
Probably because the IntsFromBytes needs a 4 byte array to make an Int. The array you create is only 1 byte. Try "0000002C"
 

Similar Threads

Top