有人能帮我如何使用这些数据吗?
Dim String as String = "thing=lol1 thing=lol2 thing=lol3 ..."我想以某种方式使用这些数据:
For i As Integer
Dim webClient1 As New System.Net.WebClient
Dim result As String = webClient1.DownloadString("http://pr2hub.com/submit_rating.php?level_id=" + lol1)
Next下一个是
Dim result As String = webClient1.DownloadString("http://pr2hub.com/submit_rating.php?level_id=" + lol2)然后
Dim result As String = webClient1.DownloadString("http://pr2hub.com/submit_rating.php?level_id=" + lol3)那么,我如何使用"=“和”“之间的数据呢?
发布于 2014-02-16 15:05:50
因此,基本上,您有一个包含键/值对的字符串,该字符串由空格分隔。您可以使用Split方法提取必要的信息:
Dim result as String = "thing=lol1 thing=lol2 thing=lol3 ..."
Dim tokens = result.Split(New String() {" "}, StringSplitOptions.RemoveEmptyEntries)
For Each token As String In tokens
Dim kvp = token.Split(New String() {"="}, StringSplitOptions.RemoveEmptyEntries)
If kvp.Length > 1 Then
Dim key as String = kvp(0)
Dim value as String = kvp(1)
' Do something with the key and value here
End If
Nexthttps://stackoverflow.com/questions/21812838
复制相似问题