tags:

views:

255

answers:

4

I am using a string to store key=value pairs, it has same format as QueryString

How can I easily parse it to array? or can I somehow use interal class QueryString("paramname") to access it?

A: 

String.Split() probably will work for you....

Sam
A: 
' parse to pairs
                Dim resultarray As Array = allresultdata.Split("&")
                Dim result1 As String
                Dim keyvals2 As Array
                For Each result1 In resultarray
                    keyvals2 = result1.Split()
                    keyvals.Set(keyvals2(0), keyvals2(1))
                Next
Tom
+2  A: 

You could use the System.Web.HttpUtility.ParseQueryString, this will give you a NameValueCollection. You can then access your values easily

Dim keynameValue As String = nameValueCollection.Get("Keyname")
georg
A: 

or can I somehow use interal class QueryString("paramname") to access it?

If you need to access querystring from another class other then page code behind, use this :

HttpContext.Current.Request.QueryString("parameterName")
Canavar