Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Tuning & Debugging > Symbol Handling > Converting between Expressions & Strings > SyntaxLength >
Mathematica > Core Language > Package Development > Namespace Management > Symbol Handling > Converting between Expressions & Strings > SyntaxLength >

SyntaxLength

SyntaxLength
finds the number of characters starting at the beginning of a string that correspond to syntactically correct input for a single Mathematica expression.
  • SyntaxLength effectively returns the position of a syntax error, if one exists.
  • If SyntaxLength returns a position past the end of the string, it indicates that the string is syntactically correct as far as it goes, but needs to be continued in order to correspond to input for a complete Mathematica expression.
Give the length of the syntactically correct beginning substring:
The syntactically correct part can be converted to an expression:
Give the length of the syntactically correct beginning substring:
In[1]:=
Click for copyable input
Out[1]=
The syntactically correct part can be converted to an expression:
In[2]:=
Click for copyable input
Out[2]=
New in 2
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF