Skip to content

ToString

ToString[expr, form] converts expr into a string using printing method form.

Attributes[ToString] := {Protected}

Simple examples

In[1]:= ToString[a^2, InputForm]
Out[1]= "a^2"
In[2]:= ToString[Sin[1], TeXForm]
Out[2]= "\sin \left(1\right)"
In[3]:= ToString["Hello World"]
Out[3]= "Hello World"