Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > String Manipulation >

ToExpression

ToExpression[input]
gives the expression obtained by interpreting strings or boxes as Mathematica input.
ToExpression[input, form]
uses interpretation rules corresponding to the specified form.
ToExpression[input, form, h]
wraps the head h around the expression produced before evaluating it.
  • ToExpression[input, form, Hold] can be used to convert input to an expression, but with the expression wrapped in Hold to prevent evaluation.  »
Convert a string to an expression, and evaluate the expression:
In[1]:=
Click for copyable input
Out[1]=
 
Interpret a TraditionalForm string:
In[1]:=
Click for copyable input
Out[1]=
 
Convert boxes to Mathematica input:
In[1]:=
Click for copyable input
Out[1]=
 
Convert MathML strings to expressions:
In[1]:=
Click for copyable input
Out[1]=
 
Convert TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X strings to expressions:
In[1]:=
Click for copyable input
Out[1]=
New in 1 | Last modified in 5.1
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team