S SFE Member Licensed User Mar 22, 2023 #1 Hello I am receiving serial data and I put it in a string called ParseData. I then try to attempt to convert the string to Float but I get an error stating it cannot Parse. If I manually assign the string to the same value there is no problem. I would think a string is a string but obviously there is some difference that I am missing Thanks for any suggestions Here is the value coming from my serial data that does not work. I then added the 2nd line that reassigns to the literal value of 60.94 and that does work The error I get when it hits the line with the float statement is Attachments 1679447284966.png 7 KB · Views: 439
Hello I am receiving serial data and I put it in a string called ParseData. I then try to attempt to convert the string to Float but I get an error stating it cannot Parse. If I manually assign the string to the same value there is no problem. I would think a string is a string but obviously there is some difference that I am missing Thanks for any suggestions Here is the value coming from my serial data that does not work. I then added the 2nd line that reassigns to the literal value of 60.94 and that does work The error I get when it hits the line with the float statement is
E emexes Expert Licensed User Longtime User Mar 22, 2023 #2 Try adding these test lines: B4X: Copy Log(RcvString) Log(RcvString.Length) Log(X) ParseData=RcvString.SubString2(1,X-1) Log(ParseData) Log(ParseData.Length) Log(ParseData.CompareTo("60.94")) Log(IsNumber(ParseData)) and share (copy, paste) the Log results to this thread. My best theory at moment is that ParseData has a non-obvious leading space. ? Upvote 0
Try adding these test lines: B4X: Copy Log(RcvString) Log(RcvString.Length) Log(X) ParseData=RcvString.SubString2(1,X-1) Log(ParseData) Log(ParseData.Length) Log(ParseData.CompareTo("60.94")) Log(IsNumber(ParseData)) and share (copy, paste) the Log results to this thread. My best theory at moment is that ParseData has a non-obvious leading space. ?
S SFE Member Licensed User Mar 22, 2023 #3 You are wise beyond your years. Being a newbie I set a break point and tried to copy the 60.94 to the clipboard to view it for spaces but never could get it to copy. It never dawned on my to write the length to the log. Lesson learned the log is my friend and I will not forget it. Also pulling that leading space out it now recognizes it as a number as well. Between this community and Erel I want to say this is the best product I have encountered. Usually I have to go it alone to figure things out. Thank you, for the assistance it saved me some valuable time. Upvote 0
You are wise beyond your years. Being a newbie I set a break point and tried to copy the 60.94 to the clipboard to view it for spaces but never could get it to copy. It never dawned on my to write the length to the log. Lesson learned the log is my friend and I will not forget it. Also pulling that leading space out it now recognizes it as a number as well. Between this community and Erel I want to say this is the best product I have encountered. Usually I have to go it alone to figure things out. Thank you, for the assistance it saved me some valuable time.
E emexes Expert Licensed User Longtime User Mar 22, 2023 #4 SFE said: You are wise beyond your years. Click to expand... Thank you ? but in reality my situation here is closer to: more arse than class Last edited: Mar 23, 2023 Upvote 0
SFE said: You are wise beyond your years. Click to expand... Thank you ? but in reality my situation here is closer to: more arse than class
S SFE Member Licensed User Mar 22, 2023 #5 In VB6 I could fly but being in B4X I feel like I am mentally challenged : ) So having someone push me in the right direction is greatly appreciated. There are so many tools in B4X that exist problem is I just don't know they are there. Good thing for the search function on these forums. Upvote 0
In VB6 I could fly but being in B4X I feel like I am mentally challenged : ) So having someone push me in the right direction is greatly appreciated. There are so many tools in B4X that exist problem is I just don't know they are there. Good thing for the search function on these forums.