i am trying to split the following data
using this way
Paramnum(2) raise an exception java.lang.ArrayIndexOutOfBoundsException: length=1; index=2
i have been told in other thread from @DomManFred to remove BOM Header using bytesbuilder which i couldn't figure out how to use it correctly in this manner .
then from server side i already set WriteBOM To false but i am still getting the exception if i try to get Paramnum that its index (1) or (2) or (3)
The weird thing is when i loop through it
i see each one of the splited string without any problems i am trying from yesterday to see a workaround but i couldn't
B4X:
2CLIENTS~������������|
URL1~URL2~URL3~URL4~URL5~
using this way
B4X:
Public Sub NewData (data() As Byte)
Dim msg As String
msg = BytesToString(data, 0, data.Length, "UTF-8")
msg = msg.Trim
msg = msg.Replace(CRLF, "")
msg = msg.Replace(Chr(10), "")
msg = msg.Replace(Chr(13), "")
Dim param As String = msg
Dim paramnum() As String = Regex.Split("\~", param)
Log(paramnum(2))
End Sub
Paramnum(2) raise an exception java.lang.ArrayIndexOutOfBoundsException: length=1; index=2
i have been told in other thread from @DomManFred to remove BOM Header using bytesbuilder which i couldn't figure out how to use it correctly in this manner .
then from server side i already set WriteBOM To false but i am still getting the exception if i try to get Paramnum that its index (1) or (2) or (3)
The weird thing is when i loop through it
B4X:
For i = 0 To paramnum.Length-1
Log(paramnum(i))
Next
i see each one of the splited string without any problems i am trying from yesterday to see a workaround but i couldn't