convert to string - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Data Types : Strings : convert to string

convert/string

convert an expression to a string

 Calling Sequence convert(expr, string) convert(expr, string, opts)

Parameters

 expr - expression opts - (optional) option name or equation of the form option = value where option is one of format, sourceformat, or targetformat.

Options

 • format : string
 The option behaves identically to targetformat, but is only valid when expr is not itself a ByteArray or string.
 • sourceformat : string
 A string corresponding to one of the file formats described in Formats. The input expr will be decoded using the specified format and the data returned as a string. If the format specified is not one for which a string is a valid output type, an error is issued.
 • targetformat : string
 A string corresponding to one of the file formats described in Formats. The input expr will be encoded in the specified format and the encoded data returned as a string.

Description

 • The convert(expr, string) calling sequence converts the expression expr to a string.
 • To convert a string to an expression, refer to the parse command.

Examples

 > $\mathrm{convert}\left(a,\mathrm{string}\right)$
 ${"a"}$ (1)
 > $\mathrm{convert}\left(\mathrm{sin}\left({x}^{2}\right),\mathrm{string}\right)$
 ${"sin\left(x^2\right)"}$ (2)
 > $\mathrm{convert}\left(a+b+cd,\mathrm{string}\right)$
 ${"c*d+a+b"}$ (3)

Compatibility

 • The convert/string command was updated in Maple 2022.

 See Also