Evaluating Strings

Overview

Several Logic Tags are used to evaluate strings and output results to the content.

Tags

Strings can be variable (set in the template %%set string1 = "Hello"%%), or Contact or Custom Data ($email, $customString). Literal strings are not supported in the following evaluation tags.

 

Tag

%%eval length STRING%%

Parameters

STRING: Variable, Custom Data, or Contact Data

Output

Output the number of characters in the string.

Example

%%set strLength = "string"%% %%eval length $strLength%%

Results

6

 

 

Tag

%%eval lower STRING%%

Parameters

STRING: Variable, Custom Data, or Contact Data

Output

Output the defined string in all lowercase characters.

Example

%%set evalLow = "LOWERCASE"%% %%eval lower $evalLow%%

Results

lowercase

 

 

Tag

%%eval proper STRING%%

Parameters

STRING: Variable, Custom Data, or Contact Data

Output

Output the defined string in all lowercase characters except convert the first character of the string to uppercase.

Example

%%set evalProper = "proper CASE"%% %%eval proper $evalProper%%

Results

Proper case

 

 

Tag

%%eval upper STRING%%

Parameters

STRING: Variable, Custom Data, or Contact Data

Output

Output the defined string in all uppercase characters.

Example

%%set evalUp = "uppercase"%% %%eval upper $evalUp%%

Results

UPPERCASE

 

 

Tag

%%eval replace STRING_ORIGINAL STRING_OLD STRING_NEW%%

Parameters

STRING_ORIGINAL: Variable STRING_OLD STRING_NEW: Variable, Custom Data, or Contact Data

Output

Set the original string to a new value by replacing the Old characters with the New characters anywhere they appear in the original string then output the results.  If the original string is a custom data field, the new string will be output to the content, but is not saved to the custom data field.

Example

%%set strOriginal = "Original String"%% %%set strOld = "Original"%% %%set strNew = "New"%% %%eval replace $strOriginal $strOld $strNew%%

Results

New String