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.
Details and Options
- The following options can be given:
-
CharacterEncoding "Unicode" what raw character encoding to use FormatType OutputForm default format for printing expressions NumberMarks $NumberMarks when to use ` marks in approximate numbers PageWidth Infinity number of character widths per line TotalWidth Infinity maximum number of character widths for a single expression - The default setting CharacterEncoding"Unicode" faithfully preserves all special characters in the input expression.
- ToString uses any relevant definitions given for Format and MakeBoxes. »
Examples
open allclose allBasic Examples (2)
Scope (2)
Strings for OutputForm, InputForm, StandardForm, and TraditionalForm of an expression:
Options (4)
FormatType (1)
Use FormatType to change the formatting:
NumberMarks (1)
Use the default setting of InputForm formatting:
Applications (2)
Properties & Relations (3)
Use ToExpression to convert strings or boxes to expressions:
Use ToBoxes to convert expressions to boxes:
Use ToString with ToExpression to convert TeX to Wolfram Language syntax:
Possible Issues (1)
ToString by default uses OutputForm formatting:
Text
Wolfram Research (1988), ToString, Wolfram Language function, https://reference.wolfram.com/language/ref/ToString.html (updated 1996).
CMS
Wolfram Language. 1988. "ToString." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/ToString.html.
APA
Wolfram Language. (1988). ToString. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ToString.html