Created
April 3, 2022 23:49
-
-
Save pandieme/636d9e277c539838f77e29eb3e8a5842 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Format-Query( | |
[Parameter(Mandatory)] | |
[hashtable] | |
$Table | |
) { | |
<# | |
.SYNOPSIS | |
Format URI query | |
.DESCRIPTION | |
Take a hashtable and format as a URI query string | |
#> | |
$Query = @() | |
$Table.GetEnumerator() | ForEach-Object { | |
$Query += ($_.Key + "=" + $_.Value) | |
} | |
return $Query | Join-String -Property $_ -Separator "&" -OutputPrefix "?" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
Output: