namnach Member Licensed User Longtime User Feb 19, 2014 #1 Hi i find many to Hex to Decimal but not Decimal to Hex... is there any way for a simple convert a integer ..127 to the hex ..7F i need the 7F as String in a later second variable i mean that will do in second for me.... Dim StrValue as String Dim ValString as Int StrValue = ValString Thank you!
Hi i find many to Hex to Decimal but not Decimal to Hex... is there any way for a simple convert a integer ..127 to the hex ..7F i need the 7F as String in a later second variable i mean that will do in second for me.... Dim StrValue as String Dim ValString as Int StrValue = ValString Thank you!
derez Expert Licensed User Longtime User Feb 19, 2014 #2 There are probably simpler ways but this works: B4X: Dim bc As ByteConverter Dim val(1) As Int val(0) = 127 Log(bc.HexFromBytes(bc.IntsToBytes((val)))) It gives 0000007F Upvote 0
There are probably simpler ways but this works: B4X: Dim bc As ByteConverter Dim val(1) As Int val(0) = 127 Log(bc.HexFromBytes(bc.IntsToBytes((val)))) It gives 0000007F
namnach Member Licensed User Longtime User Feb 19, 2014 #3 thank you for answere ... ...yes!!! it works!!! thank you!!! .. I try B4X: Dim bc As ByteConverter Dim val(1) As Int Dim d2 as string val(0) = 127 d2 = bc.HexFromBytes(bc.IntsToBytes((val))) LOG(d2.Substring(d2.Length -3 + 1 )) It gives 7F is there are shorter way for 7F ? thanks!! Last edited: Feb 20, 2014 Upvote 0
thank you for answere ... ...yes!!! it works!!! thank you!!! .. I try B4X: Dim bc As ByteConverter Dim val(1) As Int Dim d2 as string val(0) = 127 d2 = bc.HexFromBytes(bc.IntsToBytes((val))) LOG(d2.Substring(d2.Length -3 + 1 )) It gives 7F is there are shorter way for 7F ? thanks!!
DonManfred Expert Licensed User Longtime User Mar 1, 2014 #4 If it is an int you could use Bit.ToHexString(intvalue) i think Upvote 0