PRODUCTS
Products Overview
Mathematica
Mathematica for Students
Mathematica Home Edition
Wolfram
CDF Player
(free download)
Computable Document Format (CDF)
web
Mathematica
grid
Mathematica
Wolfram
Workbench
Mathematica
Add-Ons
Wolfram|Alpha Products
SOLUTIONS
Solutions Overview
Engineering
Aerospace Engineering & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Materials Science
Mechanical Engineering
Operations Research
Optics
Petroleum Engineering
Biotechnology & Medicine
Bioinformatics
Medical Imaging
Finance, Statistics & Business Analysis
Actuarial Sciences
Data Analysis & Mining
Econometrics
Economics
Financial Engineering & Mathematics
Financial Risk Management
Statistics
Software Engineering & Content Delivery
Authoring & Publishing
Interface Development
Software Engineering
Web Development
Science
Astronomy
Biological Sciences
Chemistry
Environmental Sciences
Geosciences
Social & Behavioral Sciences
Design, Arts & Entertainment
Game Design, Special Effects & Generative Art
Education
STEM Education Initiative
Higher Education
Community & Technical College Education
Primary & Secondary Education
Students
Technology
Computable Document Format (CDF)
High-Performance & Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
SUPPORT
Support Overview
Knowledge Base
Learning Center
Community & Forums
Training & Free Seminars
Does My Site Have a License?
Wolfram User Portal
COMPANY
About Wolfram Research
News & Events
Wolfram Blog
Partnerships
Employment Opportunities
History of
Mathematica
Stephen Wolfram's Home Page
Contact Us
OUR SITES
All Sites
Wolfram|Alpha
Demonstrations Project
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Media
Wolfram
Tones
Wolfram Science
Stephen Wolfram
DOCUMENTATION CENTER SEARCH
New to
Mathematica
?
Find your learning path
»
Mathematica
>
Core Language
>
String Manipulation
>
ToString
>
BUILT-IN MATHEMATICA SYMBOL
The Representation of Textual Forms
Tutorials »
|
ToBoxes
ToExpression
HoldForm
WriteString
SymbolName
See Also »
|
Character Operations
Converting between Expressions & Strings
String Manipulation
Symbol Handling
More About »
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.
MORE INFORMATION
ToString
supports the same set of options as
OpenAppend
, with default settings
FormatType
->
OutputForm
,
PageWidth
->
Infinity
,
TotalWidth
->
Infinity
.
ToString
uses any relevant definitions given for
Format
and
MakeBoxes
.
»
EXAMPLES
CLOSE ALL
Basic Examples
(2)
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]:=
Out[1]=
In[2]:=
Out[2]=
Give a string corresponding to the
InputForm
:
In[1]:=
Out[1]=
Scope
(3)
Strings for
OutputForm
,
InputForm
,
StandardForm
, and
TraditionalForm
of an expression:
Non-default character encoding:
String representation of boxes:
Options
(4)
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:
Applications
(2)
Construct an indexed set of variables:
Export data to files with programmatically created names:
Properties & Relations
(4)
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
:
Possible Issues
(1)
ToString
by default uses
OutputForm
formatting:
Specify other formats to preserve styling information:
SEE ALSO
ToBoxes
ToExpression
HoldForm
WriteString
SymbolName
TUTORIALS
The Representation of Textual Forms
MORE ABOUT
Character Operations
Converting between Expressions & Strings
String Manipulation
Symbol Handling
RELATED LINKS
NKS|Online
(
A New Kind of Science
)
New in 1 | Last modified in 3