Skip to main content
Participant
April 13, 2013
Question

process calculation from text

  • April 13, 2013
  • 1 reply
  • 1096 views

Hi,

I there an easy way to process a calculation that is in text form as in:

"2567 + 82736"

"1000 * (27363 / 38374)"

"3434 + 34334  + 34332 + 83938"

Or do the strings have to be parsed and processed that way.  I was hoping there was a way to evaluate the calculation?

thanks.

    This topic has been closed for replies.

    1 reply

    BreakawayPaul
    Inspiring
    April 14, 2013

    You can use LSParseNumber() around your strings to convert them to numeric values, then just add them.

    Inspiring
    April 14, 2013

    I don't think so.  The string is not a number, it's a formula.

    He might be able to use evaluate().  Mind you, if you can put "1 + 1" into a textbox, you can also put in "fred flinstone".

    BreakawayPaul
    Inspiring
    April 14, 2013

    Dan Bracuk wrote:

    I don't think so.  The string is not a number, it's a formula.

    Good point.  I was thinking he'd wrap the individual numbers, not the entire expression, but I see what he's saying now.