Text data type

The text data type is used to represent a string of Unicode characters.

Value range

The text data type can contain from 0 to approximately two billion (2 ^ 31) Unicode characters. This value may be limited by the subscription that is processing the template.

Auto-escape

A text value can be optionally flagged as 'safe' or 'escape'. When flagged as 'safe' the value will not be HTML-encoded when rendered. When flagged as 'escape' the value will be HTML-encoded when rendered. If there is no flag set then the text will only be HTML-encoded if the subscription that is processing the template has auto-escape turned on.

Literals

A text value can be expressed as a literal using the 'your text' or "your text" syntax.

A backslash (\) acts as an escape character. \n inserts a line feed, \r inserts a carriage return and \t inserts a tab.

Examples: "David shouted \"Hello!\".", 'This is line 1\r\nThis is line 2', "A backslash is: \\"

The literal can be followed by a method in the same way a variable can. For example: "alpha bravo charlie".TitleCase

Methods

Name Description Return type
CapFirst Capitalises the first character. Text
Contains Returns a value indicating whether the text contains a specified text. Boolean
Cut Returns the text with a specified text value removed. Text
Encrypt Encrypts this text. Text
EndsWith Tests if the end of the text matches the specified text. Boolean
Equals Returns a value indicating whether this text is equal to another specified text. Boolean
Escape Flags the text as 'escape' so it will be escaped when rendered. Text (escape)
EscapeNow Returns text as HTML-encoded. Text (safe)
JavaScriptEncode Returns text as JavaScript-encoded. Text (safe)
Length Returns the number of characters. Number
LineBreaks Inserts <p> and <br> html elements in place of line breaks. Text (safe)
LineBreaksBrOnly Inserts the <br> html element in place of line breaks. Text (safe)
LowerCase Converts the text to lower case. Text
RemoveTags Removes any tags from the text. Text
Replace Replaces a specified text value with another specified text value. Text
Safe Flags the text as 'safe' so it will not be escaped when rendered. Text (safe)
Slugify Converts to lower case, removes non-word characters and converts white-space to hyphens. Text (safe)
StartsWith Tests if the beginning of the text matches the specified text. Boolean
TitleCase Converts the text to title case. Text
Trim Removes all leading and trailing white-space characters. Text
TruncateChars Returns a specified number of characters. Text
TruncateWords Returns a specified number of words. Text
UpperCase Converts the text to upper case. Text
UrlEncode Returns text as URL-encoded. Text
WordCount Returns the number of words in the text. Number