TextString
TextString[expr]
gives a human-readable string representation of expr.
Details and Options
- TextString converts expressions to a single string, formatting expressions with the following heads specially:
-
String formats unchanged Integer,Real,Rational formats using decimal notation Quantity formats using decimal notation with unit DateObject formats according to DateFormat TimeObject formats according to TimeFormat GeoPosition formats using degrees latitude and longitude Entity formats using CommonName Symbol formats using SymbolName Missing formats according to MissingString List formats elements, combining as specified by ListFormat Association formats keys and values, combining as specified by AssociationFormat - TextString[Row[list]] formats as a concatenation of elements of list.
- TextString[Row[list,sep]] uses separator sep to combine formatted elements.
- TextString[Column[list]] formats each element on a separate line.
- TextString[TableForm[list]] formats a list of lists as space-separated columns.
- Expressions that match patterns in the list given as the setting for ElidedForms are formatted in an elided way.
- In other cases, expressions are formatted using InputForm.
- TextString supports the following options:
-
AssociationFormat Automatic format to use when formatting associations BooleanStrings {"True","False"} strings to use for True and False DateFormat $DateStringFormat format to use for dates ElidedForms Automatic list of heads whose contents should be elided ListFormat Automatic format to use when formatting lists MissingString "" string to use for Missing objects TimeFormat Automatic format to use for times TimeZone $TimeZone time zone used to convert times before formatting
Examples
open allclose allBasic Examples (3)
Scope (4)
By default, TextString converts certain built-in expressions to an elided string:
TextString recurses arbitrarily through lists and associations to convert an expression:
Typically, expressions that satisfy NumericQ are formatted as real numbers:
Row formats as a concatenation of its contents:
Column formats each element on a new line:
TableForm formats elements as a table in which columns are space-separated:
Options (6)
AssociationFormat (1)
By default, TextString formats associations as they normally appear in the Wolfram Language:
BooleanStrings (1)
DateFormat (1)
TextString uses the same default format as DateString:
ElidedForms (1)
The default value ElidedForms->Automatic elides certain complex symbolic expressions:
Ordinary symbolic expressions are formatted normally:
Elide specific symbolic expressions:
Elide all symbolic expressions for which specific formatting rules do not exist:
ListFormat (1)
By default, TextString formats lists as they normally appear in the Wolfram Language:
MissingString (1)
By default, expressions with head Missing are ignored:
Properties & Relations (1)
UpValues can be defined for custom objects to determine how they should be formatted by TextString:
Text
Wolfram Research (2014), TextString, Wolfram Language function, https://reference.wolfram.com/language/ref/TextString.html.
CMS
Wolfram Language. 2014. "TextString." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TextString.html.
APA
Wolfram Language. (2014). TextString. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TextString.html