splitUrlParameters

fun splitUrlParameters(url: ERROR CLASS: Symbol not found for Url): Map<String, String>(source)

Splits the parameters of a Url into a map of key-value pairs.

Unlike a manual split("&") / split("=") implementation, this relies on Ktor's built-in parameters parser (Url.parameters), which already handles URL-decoding, malformed pairs, and parameters without a value.

Note: if a parameter key appears multiple times (e.g. ?a=1&a=2), only the first value is kept, since the return type is Map<String, String>. Use Url.parameters directly if you need all values for repeated keys.

Return

a map of decoded parameter names to their first decoded value.

Parameters

url

the Url whose parameters should be extracted.

Samples


Splits the parameters of a raw URL String into a map of key-value pairs.

Convenience overload for callers that have a URL as plain text rather than a parsed Url instance. Internally parses url with Ktor's Url constructor and delegates to splitUrlParameters.

Return

a map of decoded parameter names to their first decoded value.

Parameters

url

the URL string whose parameters should be extracted.

Samples