I'm converting this function from VB, but for reasons i don't understand i get a compile error on the return= line saying missing parameter.
Also, is my loop parsing the whole string, i'm a bit confused wtih strings starting at byte 0 and some functions returning length-1 ?
thanks
Also, is my loop parsing the whole string, i'm a bit confused wtih strings starting at byte 0 and some functions returning length-1 ?
thanks
B4X:
'An NMEA checksum is calculated as the XOR of bytes between (but not including) the dollar sign and asterisk.
Sub NMEA_Checksum(sentence As String) As String
Dim s As String
Dim i As Int
Dim sum(0) As Byte
s = sentence.Trim
sum(0)=0
For i = 0 To s.Length+1
sum(0) = Bit.Xor(sum(0),Asc(s.SubString2(i,i)))
Next
'debug.print "Chk=";CstrHex(sum)
Return = Conv.HexFromBytes(sum())
End Sub