getUrlQueryParameter

Modified on Wed, 02 Aug 2023

Description

Return the first value associated with the given search parameter in a URL.

Syntax

getUrlQueryParameter(url, parameter)

Parameters

Input ParameterTypeDescription
urlstringURL string
parameterstringQuery parameter

Return value

Type
string | null

Sample

ExampleResultDescription
getUrlQueryParameter('https://example.com?k1=v1&k2=v2', 'k2')'v2'Get query paramter value for 'k2'

To view all the String functions, click here.

See Also