Function eval

Source
pub fn eval(expr: &str) -> Result<f64, String>
Expand description

Evaluate a string, returns the result as String

§Errors

This function will return an Error if the string is not a valid expression or it overflowed f64 or i64.

§Examples

use expr_rs::eval;
 
println!("{}", eval("1+2").unwrap());