D DaOne Member Licensed User Longtime User Jun 23, 2014 #1 I have a string that contains a 2 digit hex value such as "1A" or "AF". I need to convert this to an integer (The decimal equivalent). Is there an easy way to do this?
I have a string that contains a 2 digit hex value such as "1A" or "AF". I need to convert this to an integer (The decimal equivalent). Is there an easy way to do this?
D DaOne Member Licensed User Longtime User Jun 23, 2014 #3 Ok I think I am lost. Maybe you can help? I am inputting a value from 00 to FF from a string. No matter what I do when tying to convert this I get a force close. Here is my code. Code: Copy Dim i As Int i = Bit.ParseInt("DataIn(4)", 4) Toast.Show(i,True) Upvote 0
Ok I think I am lost. Maybe you can help? I am inputting a value from 00 to FF from a string. No matter what I do when tying to convert this I get a force close. Here is my code. Code: Copy Dim i As Int i = Bit.ParseInt("DataIn(4)", 4) Toast.Show(i,True)
NJDude Expert Licensed User Longtime User Jun 23, 2014 #4 Something like this: Code: Copy Dim I As Int Dim Data As String Data = "FF" I = Bit.ParseInt(Data, 16) Msgbox(I, "") Upvote 0
Something like this: Code: Copy Dim I As Int Dim Data As String Data = "FF" I = Bit.ParseInt(Data, 16) Msgbox(I, "")
D DaOne Member Licensed User Longtime User Jun 23, 2014 #5 Thank you for your help! This worked.. (I forgot the quotes and moved 4 to 16) Code: Copy Dim i As Int i = Bit.ParseInt(DataIn(4), 16) Toast.Show(i,True) Upvote 0
Thank you for your help! This worked.. (I forgot the quotes and moved 4 to 16) Code: Copy Dim i As Int i = Bit.ParseInt(DataIn(4), 16) Toast.Show(i,True)
merlin2049er Well-Known Member Licensed User Longtime User Apr 20, 2015 #6 I guess that would also work for a 4 digit hex value. Upvote 0
K kaudie Member Licensed User Longtime User Oct 12, 2015 #7 Why do I get an error when I try this? Dim Str_HexNumber As String Str_HexNumber = "DA2DDE56" Dim Int_Number As Int Int_Number = Bit.ParseInt(Str_HexNumber, 16) The error is: java.lang.NumberFormatException: Invalid int: "DA2DDE56" thanks Upvote 0
Why do I get an error when I try this? Dim Str_HexNumber As String Str_HexNumber = "DA2DDE56" Dim Int_Number As Int Int_Number = Bit.ParseInt(Str_HexNumber, 16) The error is: java.lang.NumberFormatException: Invalid int: "DA2DDE56" thanks
DonManfred Expert Licensed User Longtime User Oct 12, 2015 #8 1. This is an old thread. Create a new one. 2. Dont make dublicate posts Last edited: Oct 12, 2015 Upvote 0