Evaluating a string as a variable name
My program will replace some strings in text source files of a scripted program in order to customise the scripts.
Here is a sample of text :
var PROJECT=/*Name_Of_Project*/="Default Project Name";
The sequence "/*Name_Of_Project*/" is a comment which is also acting as my target for string search, which is not the problem.
If the string "Name_Of_Project" is padded up
"/*" & "Name_Of_Project" & "*/"
it will form the string to search for.
But if I also have declared in the VBasic
Public Name_Of_Project As String
How to take a parameter inside my function that has been given the string value
"Name_Of_Project" and make it give me the value of the Public String Variable
var Y = "X"
The expression eval(Y) will return the string "Apple".
Is there any equivalent in VBasic?
As I have a number of such strings and variables planned it will make the code more compact if I was able to use such a device.