Jump to content

val(string) or eval(string) a la bash $(())?

Recommended Posts

I see number()

Local $dNumber1 = Number(1 + 2 + 10) ; Returns 13.


Is there an equivalent for a string arg? e.g. val("1 + 2 + 10").


The bash equivalent to the above would be:

dNumber1=$((1 + 2 + 10)) # Returns 13.



myexpression='1 + 2 + 10'

dNumber1=$(("${myexpression}")) # Returns 13.


would be the same. Which is only to say, whether the contents are a string or number or formula doesn't matter to it. (Because the interpreter would strip the quotes off first.)


So, is there a way to have the quotes stripped off before number() interprets something like: number("1 + 2 + 10")



I have an input box where I ask the user for a number. It occurs to me that instead of manually calculating some input value, the computer could do it for them.

e.g. "(1,200,000,000 * 7 - 350,000,000) / 26,500,000"

[Yes, I know, the commas are problematic there.]


Thoughts or suggestions?

Link to post
Share on other sites

Have you tried the EXECUTE function?

MsgBox(0, "", '"1+2+10" = ' & Execute("1+2+10"))


Edited by TheXman
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...