点击或拖拽改变大小

Evaluate Function (String, Logic)

X#
评估包含在字符串中的表达式。

命名空间:  XSharp.RT
程序集:  XSharp.RT (在 XSharp.RT.dll 中) 版本:2.24 GA
Syntax
[NeedsAccessToLocalsAttribute(TRUE)]
 FUNCTION Evaluate(
	cString AS STRING,
	lAllowSingleQuotes AS LOGIC
) AS USUAL
Request Example 查看代码

Parameters

cString
类型:String
包含要评估的表达式的字符串。
lAllowSingleQuotes
类型:Logic
Should single quotes be allowed as string delimiters.

Return Value

类型:Usual
表达式的值。
备注
Evaluate() 每次评估表达式时都会调用宏编译器。
另外,您可以使用 MCompile() 只编译一次表达式,然后使用 MExec() 根据需要多次执行编译后的形式。
Examples
此示例展示了 Evaluate() 的典型用法:
X#
1LOCAL cVar AS STRING
2cVar := "World"
3World := "Hello"    // World 是一个 PRIVATE 变量
4? Evaluate(cVar)    // Hello
5? Evaluate("2+3")    // 5
6Two := 2    // Two 是一个 PRIVATE 变量
7Evaluate("Two+3")    // 5
See Also