Skip to content

ToString

Converts an expression to a string.

$ wo 'ToString[123]'
123
$ wo 'ToString[{1, 2, 3}]'
{1, 2, 3}
$ wo 'ToString[1 + 2]'
3

NumberForm renders a number to a given number of significant figures.

$ wo 'ToString[NumberForm[3.14159, 3]]'
3.14

With a {n, f} specification it shows exactly f digits after the decimal point (zero-padded).

$ wo 'ToString[NumberForm[3.0, {5, 2}]]'
3.00