bs27975 Posted May 12, 2019 Posted May 12, 2019 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. However: 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") Rationale: 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?
TheXman Posted May 12, 2019 Posted May 12, 2019 (edited) Have you tried the EXECUTE function? MsgBox(0, "", '"1+2+10" = ' & Execute("1+2+10")) Edited May 12, 2019 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
bs27975 Posted May 13, 2019 Author Posted May 13, 2019 (edited) 5 hours ago, TheXman said: Have you tried the EXECUTE function? MsgBox(0, "", '"1+2+10" = ' & Execute("1+2+10")) Thank you! I took Execute to be for running .exe's - this use never occurred to me. My bad. Edited May 13, 2019 by bs27975
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now