davedelong / DDMathParser

String → Number
MIT License
854 stars 153 forks source link

Get parsed equation? #165

Closed rmehta33 closed 5 years ago

rmehta33 commented 5 years ago

Hi,

Is there a way to return the "parsed" version of a string, and then evaluate that parsed form? Essentially I'm using this library to calculate values for a graph and since I'm usually only ever changing a variable or two, is there a way to do this efficiently?

Thanks

davedelong commented 5 years ago

Yes, you'd create an Expression, which is the parsed form of the string. Once you have the Expression, you can ask it to evaluate, passing in any values for the variables the expression contains.

davedelong commented 5 years ago

See also: https://github.com/davedelong/DDMathParser/wiki/Usage#advanced

rmehta33 commented 5 years ago

Perfect thanks!