Table of Contents

Class QSHelper

Namespace
SunamoUri
Assembly
SunamoUri.dll

Query string helper methods for parsing and manipulating URL query strings.

public class QSHelper
Inheritance
QSHelper
Inherited Members
Extension Methods

Methods

GetArray(List<string>, StringBuilder, bool)

Serializes a list of parameters into a JavaScript Array constructor call.

public static void GetArray(List<string> list, StringBuilder stringBuilder, bool isQuoted)

Parameters

list List<string>

The list of parameters to serialize.

stringBuilder StringBuilder

The StringBuilder to append to.

isQuoted bool

Whether to wrap values in double quotes.

GetNormalizeQS(string)

Normalizes a query string by sorting parameters alphabetically. Returns null for tracking-related query strings (contextkey, guid, SelectingPhotos).

public static string? GetNormalizeQS(string text)

Parameters

text string

The query string to normalize (without leading question mark).

Returns

string

The normalized query string, or null for tracking requests.

GetParameter(string, string)

Gets a parameter value from a URI query string. Returns null when not found. Use GetParameterSE for empty string fallback.

public static string? GetParameter(string uri, string parameterName)

Parameters

uri string

The URI containing the query string.

parameterName string

The name of the parameter to find.

Returns

string

The parameter value, or null if not found.

GetParameterSE(string, string)

Gets a parameter value from a URI query string. Returns empty string when not found. Use GetParameter for null fallback.

public static string GetParameterSE(string uri, string parameterName)

Parameters

uri string

The URI containing the query string.

parameterName string

The name of the parameter to find.

Returns

string

The parameter value, or empty string if not found.

GetQS(string, Dictionary<string, string>)

Builds a query string URL from a base address and a dictionary of parameters.

public static string GetQS(string baseUrl, Dictionary<string, string> parameters)

Parameters

baseUrl string

The base URL without a trailing question mark.

parameters Dictionary<string, string>

Dictionary of parameter key-value pairs.

Returns

string

The complete URL with query string.

GetQS(string, params string[])

Builds a query string URL from a base address and alternating key-value parameter pairs. All parameter values are automatically URL-encoded.

public static string GetQS(string baseUrl, params string[] parameters)

Parameters

baseUrl string

The base URL without a trailing question mark.

parameters string[]

Alternating key-value pairs for the query string.

Returns

string

The complete URL with query string.

ParseQs(NameValueCollection)

Parses a NameValueCollection into a dictionary.

public static Dictionary<string, string> ParseQs(NameValueCollection nameValueCollection)

Parameters

nameValueCollection NameValueCollection

The NameValueCollection to parse.

Returns

Dictionary<string, string>

A dictionary of keys and values.

ParseQs(string)

Parses a query string into a dictionary of key-value pairs. Must receive just the query string without URI path. Use UH.GetQueryAsHttpRequest before calling.

public static Dictionary<string, string> ParseQs(string queryString)

Parameters

queryString string

The query string to parse.

Returns

Dictionary<string, string>

A dictionary of parameter names and values.

RemoveQs(string)

Removes the query string from a URI.

public static string RemoveQs(string text)

Parameters

text string

The URI to process.

Returns

string

The URI without the query string.