# $$\text{ToString}$$¶

Converts a scalar to a string representation

You can use the \tostring backslash command to insert this function.

The following variants of this function are available:

• $$\text{tuple } \text{ToString} \left ( \text{<value>} \right )$$

• $$\text{tuple } \text{ToString} \left ( \text{<value>}, \text{<format>} \right )$$

The $$\text{<value>}$$ parameter can be any scalar type holding the value to be converted to a text string. The optional $$\text{<format>}$$ parameter holds the format for the converted string. A reasonable format for the supplied value will be used if the $$\text{<format>}$$ parameter is not included.

The optional $$\text{<format>}$$ parameter should be a text string containing the format to be used and should match the format used by the ANSI-C printf function.

The format should contain a single ANSI-C format specifier. For details on the format specifier, see http://www.cplusplus.com/reference/cstdio/printf/_ or a similar reference.

Figure 210 shows the basic use of the $$\text{ToString}$$ function.

Figure 210 Example Use Of The ToString Function