Вы можете сделать это:
Dim sAux() As String = sURL.Split(New Char() {"?"c, "&"c})
Dim sParams() As String
For Each elem As String In sAux
sParams = elem.Split("="c)
If sParams(0).Equales("lname", StringComparison.CurrentCultureIgnoreCase) Then
sUrl = sUrl.Replace("lname=" & sParams(1), "lname=" & sNewValue)
End If
Next
Или просто:
Dim index As Integer = sUrl.IndexOf("lname=")
Dim auxIndex As Integer = sUlr.IndexOf("&", index + 1)
Dim sAux As String
If index >= 0 Then
If auxIndex < 0 Then
sAux = sUrl.Substring(index)
Else
sAux = sUrl.SubString(index, sUrl.Length - auxIndex)
End If
sUrl = sUrl.Replace(sAux, "lname=" & sNewValue)
End If
Вы хотите сказать, , Вам нужно всегда заменить значение 2-го параметра? –
http://msdn.microsoft.com/en-us/library/dd789093.aspx – Guy