I must convert the following VB.NET code to Basic4Android code.
B4X:
Dim iCheckSumTotal As Integer
Dim sCheckSumTotal As String
Dim sCheckSumResponse As String
Dim i As Integer
Dim iCommandLength As Integer
iCommandLength = command.Length
i = 0
While i < iCommandLength
iCheckSumTotal = iCheckSumTotal + Convert.ToInt32(Convert.ToChar(command.Substring(i, 1)))
i += 1
End While
I tried many things. This is what I came up with, and it generates an exception at runtime. I knew it wouldn't work, but after searching the forums I just don't see a way to do this.
B4X:
Dim iCheckSumTotal As Int
Dim sCheckSumTotal As String
Dim sCheckSumResponse As String
Dim i As Int
Dim iCommandLength As Int
iCommandLength = command.Length
i = 0
Do While i < iCommandLength
Dim charatt As String = command.CharAt(i)
iCheckSumTotal = iCheckSumTotal + charatt
i = i+ 1
Loop
These are the values in ascii table, if you think that the transformation of A,B,C to int as 17,18,19 is OK then you can use it for non-integer characters. I just don't know what is the meaning of the transformation to integers.