Last active
July 25, 2017 08:01
-
-
Save nordinrahman/9182734 to your computer and use it in GitHub Desktop.
Create Dictionary from query string
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
' 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