in my app i have two strings s1 and s2. Both should have the same content and in my program i do a test with
This string comparison has always worked fine, but in the last weeks the comparison failed on some systems.
I'm not shure about the reasons: i have upgraded to b4a 2.0 and a lot of android systems get updates in these days.
if i look at the string content in b4a (with log, msgbox or with the tooltip popup help), they are identical.
But if i compare the strings with
b4a tells me that both strings are different.
i have transformed both strings into byte arrays and one of both strings has three bytes more at the beginning. all other bytes are identical.
As a Workaround i strip the first three bytes of the longer byte array:
This works, but i have no grasp, where the three bytes come from and what they mean...
Is this an error, or am i doing something wrong?
B4X:
if s1 = s2 then...
I'm not shure about the reasons: i have upgraded to b4a 2.0 and a lot of android systems get updates in these days.
if i look at the string content in b4a (with log, msgbox or with the tooltip popup help), they are identical.
But if i compare the strings with
B4X:
if (s1=s2) then ...
b4a tells me that both strings are different.
i have transformed both strings into byte arrays and one of both strings has three bytes more at the beginning. all other bytes are identical.
As a Workaround i strip the first three bytes of the longer byte array:
B4X:
'Workaround: strip first three bytes
Dim d1() as Byte
Dim d2() As Byte
d1=s1.GetBytes(charset)
d2=s2.GetBytes(charset)
s1=BytesToString(d1,3,d1.Length-3,charset)
s2=BytesToString(d2,0,d2.Length,charset)
If s1<>s2 Then ...
This works, but i have no grasp, where the three bytes come from and what they mean...
Is this an error, or am i doing something wrong?
Last edited: