SyntaxLength

SyntaxLength["string"]

在单个 Mathematica 表达式中求出从输入字符串开始多长的字符序列在语法上是正确.

更多信息

  • 如果存在语法错误,SyntaxLength 有效地返回语法错误的位置.
  • 如果 SyntaxLength 返回超过字符串末尾的一个位置,它表明这个字符串从语法上是正确的,但为了对应于一个Mathematica 表达式的完整输入,它需要继续.

范例

基本范例  (1)

给出语法上正确的子串的长度:

语法上正确的部分可以被转换为一个表达式:

Wolfram Research (1991),SyntaxLength,Wolfram 语言函数,https://reference.wolfram.com/language/ref/SyntaxLength.html.

文本

Wolfram Research (1991),SyntaxLength,Wolfram 语言函数,https://reference.wolfram.com/language/ref/SyntaxLength.html.

CMS

Wolfram 语言. 1991. "SyntaxLength." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/SyntaxLength.html.

APA

Wolfram 语言. (1991). SyntaxLength. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/SyntaxLength.html 年

BibTeX

@misc{reference.wolfram_2024_syntaxlength, author="Wolfram Research", title="{SyntaxLength}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/SyntaxLength.html}", note=[Accessed: 24-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_syntaxlength, organization={Wolfram Research}, title={SyntaxLength}, year={1991}, url={https://reference.wolfram.com/language/ref/SyntaxLength.html}, note=[Accessed: 24-November-2024 ]}