Evaluate Function (String, Logic) | |
Evaluate an expression contained in a string.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax [NeedsAccessToLocalsAttribute(TRUE)]
FUNCTION Evaluate(
cString AS STRING,
lAllowSingleQuotes AS LOGIC
) AS USUAL
[NeedsAccessToLocalsAttribute(true)]
public static Usual Evaluate(
string cString,
bool lAllowSingleQuotes
)
Request Example
View SourceParameters
- cString
- Type: String
The string containing the expression to evaluate. - lAllowSingleQuotes
- Type: Logic
Should single quotes be allowed as string delimiters.
Return Value
Type:
Usual
The value of the expression.
Remarks
Evaluate() invokes the macro compiler each time it evaluates an expression.
Alternatively, you could use MCompile() to compile an expression only once, then use MExec() to execute the compiled form as often as you want.
Examples
This example shows typical uses of Evaluate():
1LOCAL cVar AS STRING
2cVar := "World"
3World := "Hello"
4? Evaluate(cVar)
5? Evaluate("2+3")
6Two := 2
7Evaluate("Two+3")
See Also