How can I convert a string to a variable name in VBscript? I found similar Q/A for JavaScript, C#, Pyton, Perl, Ruby, Java, but not for VBscript.
This is why I can not work directly with variables instead of strings:
There is a list of comma separated permission names which I get from a web service. The project manager may update this list any time and expects that I check if a user of software is granted to these permissions. User's permissions are set in run time by complex methods as well as profile data, history of activities in the software etc. e.g. if a user has bought 1000 products, the variable SuperCustomerPermission will set for him in header of page using SuperCustomerPermission="yes"
(not as cookies or session nor stored in a databse).
To check the list of permission I want to pass the list of permission names to a function and loop through the names:
Permission names which I get from a web service:
permissionNames = "adminPermission,deletePermission,configPermission,SuperCustomerPermission"
I try to pass these strings as variables to the subroutine:
Sub checkPermission(PermissionNames)
permissionNamesArray = split(permissionNames,",",-1,1)
For Each x In permissionNamesArray
'How to convert x to its variable equivalent and check if it equals "yes"
Next
End Sub
Call checkPermission(permissionNames)