encoder class : ParseQueryString(string,string) method

Description

Parses a query string using a specified encoding.

Syntax

encoderInstance.ParseQueryString(string queryString, string encodingName)

Arguments

ClassNameDescription
stringqueryStringThe query string to parse.
stringencodingNameA encoding name.

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, "shift_jis");

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,Encoding) method.

Links for reference

Copyright © Cooker All rights reserved.