StringForm["controlstring",expr1,…]
prints as the text of the controlstring, with the printed forms of the expri embedded.
StringForm
StringForm["controlstring",expr1,…]
prints as the text of the controlstring, with the printed forms of the expri embedded.
Details
- `i` in the control string indicates a point at which to print expri.
- `` includes the next expri not yet printed.
- `.` prints a raw ` in the output string. »
- You can use StringForm to set up "formatted output".
- Messages given as values for objects of the form s::t are used as control strings for StringForm.
Examples
open all close allBasic Examples (3)
Scope (4)
StringForm["The integral result is ``.", Integrate[x, x]]Embed an unevaluated symbolic expression:
StringForm["The integral is ``.", HoldForm[Integrate[x, x]]]Include an explicit ` character in a string:
StringForm["The symbol `` is defined in the Global`.` context.", x]Insert any number of expressions into a string:
StringForm["`` `` `` `` ``", e1, e2, e3, e4, e5]Expressions can be inserted in the output string more than once:
StringForm["{`1`,`2`,`1`,`1`,`2`}", e1, e2]Properties & Relations (1)
StringForm prints as a string with items inserted as output:
s::t = "A string with inputs `1` and `2`.";StringForm[s::t, e1, e2]Message prints a string with items inserted:
Message[s::t, e1, e2]StringInsert inserts a string into a string:
StringInsert[StringInsert["A string with inputs and .", "e1", -7], "e2", -2]See Also
Tech Notes
Related Guides
History
Introduced in 1988 (1.0) | Updated in 2003 (5.0)
Text
Wolfram Research (1988), StringForm, Wolfram Language function, https://reference.wolfram.com/language/ref/StringForm.html (updated 2003).
CMS
Wolfram Language. 1988. "StringForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/StringForm.html.
APA
Wolfram Language. (1988). StringForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringForm.html
BibTeX
@misc{reference.wolfram_2026_stringform, author="Wolfram Research", title="{StringForm}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/StringForm.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_stringform, organization={Wolfram Research}, title={StringForm}, year={2003}, url={https://reference.wolfram.com/language/ref/StringForm.html}, note=[Accessed: 12-June-2026]}