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

ToString

ToString[expr]
gives a string corresponding to the printed form of expr in OutputForm.
ToString[expr, form]
gives the string corresponding to output in the specified form.
Give a string corresponding to the OutputForm of x2:
Give a string corresponding to the InputForm:
Strings for OutputForm, InputForm, StandardForm and TraditionalForm of an expression:
Non-default character encoding:
String representation of boxes:
Generate a string using the default encoding:
Use ASCII encoding instead:
Use FormatType to change the formatting:
Use the default setting of InputForm formatting:
Explicitly set whether number marks should be included:
By default the page width is infinite:
Wrap to a new line after 9 characters in the string:
Construct an indexed set of variables:
Export data to files with programmatically created names:
Use ToExpression to convert strings or boxes to expressions:
Use ToBoxes to convert expressions to boxes:
Use ToString with ToExpression to convert TeX to Mathematica syntax:
Use StringLength to find a string's length:
Use Characters to extract the individual characters:
ToString uses definitions from Format and MakeBoxes:
ToString by default uses OutputForm formatting:
Specify other formats to preserve styling information:
New in 1 | Last modified in 3
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team