Skip to content

Replace Tokens

Replaces the tokens of a string by the values of a Dictionary. Tokens are strings written in a specific pattern, usually enclosed in special characters. Use the combination of 'Pattern' and 'Placeholder' properties to define your token format.

Properties
Name Description
Content The text which contains the tokens to be replaced.
Dictionary The dictionary where each key/value pair are used to replace the tokens.
Pattern The token text pattern. It can have characters either before and after the placeholder.
Placeholder The placeholder where each dictionary key will found.
Result The content after the tokens replacement be performed.
Usage

Lets consider the email template as content:

Dear {{Business}},

The {{ProcessName}} ran successfully today ({{DateTime}}).

The consolidated report can be found attached.

Regards,
{{ProcessTeam}}

And the below dictionary for token replacement:

Dictionary<string, object>
{
    {"Business", "John Connor"},
    {"ProcessName", "Terminator Bot"},
    {"DateTime", "02-Jul-2022"},
    {"ProcessTeam", "Resistence"}
}

The output results:

Dear John Connor,

The Terminator Bot ran successfully today (02-Jul-2022).

The consolidated report can be found attached.

Regards,
Resistence