TextTransformationAliases.

TransformText(ICakeContext, string, string, string) Method

Summary

Creates a text transformation from the provided template, using the specified placeholder.
Namespace
Cake.Common.Text
Containing Type
TextTransformationAliases

Syntax

[CakeMethodAlias]
public static TextTransformation<TextTransformationTemplate> TransformText(this ICakeContext context, string template, string leftPlaceholder, string rightPlaceholder)

Examples

This sample shows how to create a TextTransformation<TTemplate> using the specified template and placeholder.
string text = TransformText("Hello {subject}!", "{", "}")
   .WithToken("subject", "world")
   .ToString();

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.

Parameters

Name Type Description
context ICakeContext The context.
template string The template.
leftPlaceholder string The left placeholder.
rightPlaceholder string The right placeholder.

Return Value

Type Description
TextTransformation<TextTransformationTemplate> A TextTransformation<TTemplate> representing the provided template.