W wolfray1972 Member Licensed User Mar 24, 2021 #1 Hi all, I use a barcode scanner, and use: B4X: Sresult = BytesToString(Buffer, 0, Buffer.Length, "UTF8") This gives me a Chr(13) at the end of my scan result. How to remove?? I tried replace(chr(13),""), but to no avail. Any one has an idea?
Hi all, I use a barcode scanner, and use: B4X: Sresult = BytesToString(Buffer, 0, Buffer.Length, "UTF8") This gives me a Chr(13) at the end of my scan result. How to remove?? I tried replace(chr(13),""), but to no avail. Any one has an idea?
Erel B4X founder Staff member Licensed User Longtime User Mar 24, 2021 #2 B4X: Dim len As Int = Buffer.Length If Buffer(Buffer.Length - 1) = 13 Then len = len - 1 Sresult = BytesToString(Buffer, 0, len, "UTF8") Upvote 0
B4X: Dim len As Int = Buffer.Length If Buffer(Buffer.Length - 1) = 13 Then len = len - 1 Sresult = BytesToString(Buffer, 0, len, "UTF8")
W wolfray1972 Member Licensed User Mar 24, 2021 #3 Wow that was fast. Could you explain: Buffer(Buffer.Length - 1) = 13 Then len = len - 1 It works but i would like to know why and what is it doing? Thank you in advance. Upvote 0
Wow that was fast. Could you explain: Buffer(Buffer.Length - 1) = 13 Then len = len - 1 It works but i would like to know why and what is it doing? Thank you in advance.
DonManfred Expert Licensed User Longtime User Mar 24, 2021 #4 wolfray1972 said: Buffer(Buffer.Length - 1) = 13 Click to expand... if the last character in Buffer is a chr(13) then..... Upvote 0
wolfray1972 said: Buffer(Buffer.Length - 1) = 13 Click to expand... if the last character in Buffer is a chr(13) then.....
W wolfray1972 Member Licensed User Mar 24, 2021 #5 Ah..understand now. Thank you for this fast fix. All working as it should now. Me Happy Upvote 0