Skip to content

Instantly share code, notes, and snippets.

@nordinrahman
Last active July 25, 2017 08:01
Show Gist options
  • Save nordinrahman/9182734 to your computer and use it in GitHub Desktop.
Save nordinrahman/9182734 to your computer and use it in GitHub Desktop.
Create Dictionary from query string
' Make dictionary object containing query string key name based on specified query string
function ConstructQueryStringDictionary(queryString)
Dim d
Set d = Server.CreateObject("Scripting.Dictionary")
dim keyValues
keyValues = Split(queryString, "&", -1, 1)
For Each keyValue In keyValues
dim keyName, value, lenKeyValue
keyName = ""
value = ""
lenKeyValue = Len(keyValue)
If Len(keyValue) > 0 Then
dim equalSignPosition
equalSignPosition = InStr(1, keyValue, "=", 1)
If equalSignPosition > 0 Then
keyName = Left(keyValue, equalSignPosition - 1)
value = Right(keyValue, Len(keyValue) - equalSignPosition)
End if
End If
If Len(keyName) Then
d.Add keyName, value
End If
Next
ConstructQueryStringDictionary = d
end function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment