Hi guys,
Working with bytes has never been my strongest.... nor my weakest.... it's just not "my thing"...
But since B4R deals with Strings as bytes, I am forced to work with them....
I need help parsing this string:
This is part of a Astream_NewData received message, and I am using EREL's "remote configuration" example as a base for my current endeavor...
As you can imagine, I need to retrieve the "WiFiNetworkSSID" and the "pass" values....
In the remote configuration example, the response looks more like "set/Bbox-8655E4EE/Cables" and he parses it using the following code:
Thanks in advance
Working with bytes has never been my strongest.... nor my weakest.... it's just not "my thing"...
But since B4R deals with Strings as bytes, I am forced to work with them....
I need help parsing this string:
B4X:
GET /set?WiFiNetworkSSID=Bbox-8655E4EE&pass=Cables HTTP/1.1
As you can imagine, I need to retrieve the "WiFiNetworkSSID" and the "pass" values....
In the remote configuration example, the response looks more like "set/Bbox-8655E4EE/Cables" and he parses it using the following code:
B4X:
Dim ssid = "", password = "" As String
Dim i1 As Int = 0
Dim i2 As Int = 0
For Each b1() As Byte In bc.Split(Buffer, " ")
If i1 = 1 Then
For Each b2() As Byte In bc.Split(b1, "/")
Select i2
Case 2
ssid = bc.StringFromBytes(b2)
Case 3
password = bc.StringFromBytes(b2)
End Select
i2 = i2 + 1
Next
End If
i1 = i1 + 1
Next
Thanks in advance