This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

ToString

ToString[expr]
gives a string corresponding to the printed form of expr in OutputForm.
ToString
gives the string corresponding to output in the specified form.
Give a string corresponding to the OutputForm of :
Give a string corresponding to the InputForm:
Give a string corresponding to the OutputForm of :
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Give a string corresponding to the InputForm:
In[1]:=
Click for copyable input
Out[1]=
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