Reputation: 91
For example suppose I have
var1 = "15+28*3+(15.2+2)*2"
I want to return something like
var2 = CDbl(var1) or var2 = 133.4
Which I know it is wrong. But I am wondering if there is an easy solution?
Upvotes: 1
Views: 110
Reputation: 38745
Use Eval to evaluate an expression:
>> s = "15+28*3+(15.2+2)*2"
>> WScript.Echo Eval(s)
>>
133,4
Upvotes: 2