NMKP
NMKP

Reputation: 799

split a string into and manipulate it in vbscript?

I will have to do arithmetic operation from the below string by using VBscript.

s = "1+2-3+4"

output => 4

Thanks in advance!

Upvotes: 0

Views: 80

Answers (1)

Barney
Barney

Reputation: 1895

VBScript, use the eval method

Example

total = Eval("1+2-3+4")

Excel VBA, use evaluate method Example

total = Evaluate("1+2-3+4")

Upvotes: 4

Related Questions