WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

StringTemplate ["string"]

yields a TemplateObject expression that represents a string template to be applied to arguments.

StringTemplate [src]

uses File [], URL [] or CloudObject [] as the source for the string template.

StringTemplate [form,args]

yields a TemplateObject with arguments, suitable for cloud deployment or other evaluation.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Options  
CombinerFunction  
InsertionFunction  
Properties & Relations  
Possible Issues  
Neat Examples  
See Also
Related Guides
Related Workflows
Related Links
History
Cite this Page

StringTemplate ["string"]

yields a TemplateObject expression that represents a string template to be applied to arguments.

StringTemplate [src]

uses File [], URL [] or CloudObject [] as the source for the string template.

StringTemplate [form,args]

yields a TemplateObject with arguments, suitable for cloud deployment or other evaluation.

Details and Options

Examples

open all close all

Basic Examples  (4)

Apply a string template with slots named a and b:

An equivalent form using TemplateApply :

The StringTemplate is not needed inside TemplateApply :

Apply a string template to positional arguments:

An equivalent form:

The expression inside <* ... *> is evaluated when the string template is applied:

Include a template slot as well as an expression in the template string:

Values from the association can be used in the template expression:

Rule delayed can be used to delay computations:

Expressions are spliced into the string using TextString :

Scope  (4)

File is fully supported:

Templates can be hosted in the Wolfram Cloud:

CloudObject can be directly used by TemplateApply :

The second argument of StringTemplate can be used to bound data to the template:

URL can be used to fetch templates:

Options  (2)

CombinerFunction  (1)

Specify a different way to combine parts of templates:

It can be used to return any expression, not only a string:

InsertionFunction  (1)

Specify a function to convert arguments before they are inserted:

You can use a string to specify an export format:

Properties & Relations  (3)

StringTemplate evaluates to a TemplateObject :

If you deploy a template with data, each time you visit it TemplateApply will render the content again:

TemplateApply can be used to parse and apply a string template in one step:

Possible Issues  (1)

Data in the second argument of StringTemplate takes precedence over arguments in TemplateApply :

Neat Examples  (1)

You can deploy a StringTemplate to the cloud. When you visit the URL, TemplateApply will render the template on each visit:

Related Workflows

Wolfram Research (2014), StringTemplate, Wolfram Language function, https://reference.wolfram.com/language/ref/StringTemplate.html.

Text

Wolfram Research (2014), StringTemplate, Wolfram Language function, https://reference.wolfram.com/language/ref/StringTemplate.html.

CMS

Wolfram Language. 2014. "StringTemplate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/StringTemplate.html.

APA

Wolfram Language. (2014). StringTemplate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringTemplate.html

BibTeX

@misc{reference.wolfram_2025_stringtemplate, author="Wolfram Research", title="{StringTemplate}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/StringTemplate.html}", note=[Accessed: 05-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_stringtemplate, organization={Wolfram Research}, title={StringTemplate}, year={2014}, url={https://reference.wolfram.com/language/ref/StringTemplate.html}, note=[Accessed: 05-December-2025]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /