Skip to content
Miroiu Emanuel edited this page Oct 12, 2022 · 2 revisions

MathExprExtensions Class

Namespace: StringMath

Assembly: StringMath

Inheritance: ObjectMathExprExtensions

References: MathExpr, IMathContext

Extensions for MathExpr.

public static class MathExprExtensions

Methods

Eval(String)

Evaluates a math expression from a string in a given context.

public static double Eval(string value);

Parameters

value String: The math expression.

Returns

Double: The result as a double.

Eval(String, IMathContext)

public static double Eval(string value, IMathContext context);

Parameters

value String

context IMathContext

Returns

Double

Substitute(String, String, Double)

Converts a string to a MathExpr and substitutes the given variable.

public static MathExpr Substitute(string expr, string var, double val);

Parameters

expr String: The math expression.

var String: The variable's name.

val Double: The variable's value.

Returns

MathExpr: A MathExpr.

ToMathExpr(String)

Converts a string expression to a MathExpr.

public static MathExpr ToMathExpr(string expr);

Parameters

expr String: The string to convert.

Returns

MathExpr: A MathExpr.

ToMathExpr(String, IMathContext)

public static MathExpr ToMathExpr(string expr, IMathContext context);

Parameters

expr String

context IMathContext

Returns

MathExpr

Clone this wiki locally