encoder class : ParseQueryString(string) method

Description

Parses a query string using UTF8 encoding.

Syntax

encoderInstance.ParseQueryString(string queryString)

Arguments

ClassNameDescription
stringqueryStringThe query string to parse.

Return value

ClassDescription
dictionary{string}A dictionary of query parameter and value.

Sample code

1:

encoder e = new encoder();

2:

uri u = new uri("http://example.com/foo/var.php?name1=value1&name2=value2");

3:

string queryString = u.Query; // The queryString is "?name1=value1&name2=value2".

4:

dictionary{string} queries = e.ParseQueryString(queryString);

5:

string n1 = queries.Get("name1"); // The n1 is "value1".

6:

string n2 = queries.Get("name2"); // The n2 is "value2".

Notes

It's a wrapper of the System.Web.HttpUtility.ParseQueryString(String) method.

Links for reference

Copyright © Cooker All rights reserved.