strings.extract_url_params

Supported in:
strings.extract_url_params(url_string)

Description

Extracts the URL query parameters from a URL string and adds it to an array.

Param data types

STRING

Return type

ARRAY_STRINGS

Code samples

Example 1

The following example extracts the query parameter (name) from the URL.

strings.extract_url_params("https://example.com/?name=Johnathan%20Smith") // yields this array of strings ["name:Johnathan Smith"]
Example 2

The following example yields an empty array as there are no query parameters in the URL.

strings.extract_url_params("https://example.com/") // yields an empty array []
Example 3

The following example extracts the query parameter (foo) from the URL.

strings.extract_url_params("     \t   !$5*^)&dahgsdfs;http://www.google.com/?foo=bar") // yields this array of strings ["foo:bar"]
Example 4

This example shows handling of URIs.

strings.extract_url_params("mailto:?to=&subject=&body=") // yields an empty array []
Example 5

This example shows handling of non-ASCII characters.

strings.extract_url_params("http://例子/?卷筒纸=中国") // yields this array of strings ["卷筒纸:中国"]