Cognito Forms logo

Text functions

Here is a full list of supported text functions that you can call by typing a . after text field:

Returns

Function

Description

Number

CompareTo(Text)

Compares the value of this instance to a specified text value.  Returns -1, 0, or 1 which means the instance precedes, same as, or follows the text in sort order, respectively.

Yes/No

Contains(Text)

Returns whether this instance contains the specified text.

Yes/No

EndsWith(Text)

Returns whether the end of this instance ends with the specified text.

Number

IndexOf(Text)

Returns the zero-based index of the first occurrence of the specified text in this instance.

Number

IndexOf(Text,Number)

Returns the zero-based index of the first occurrence of the specified text in this instance.  The search will start at the specified character position.

Number

IndexOf(Text, Number, Number)

Returns the zero-based index of the first occurrence of the specified text in this instance.  The search will start at the specified character position and examines the specified number of positions.

Text

Insert(Number, Text)

Returns a new text equivalent to this instance but with a text inserted at the specified character position.

Number

LastIndexOf(Text)

Returns the zero-based index of the last occurrence of the specified text in this instance.

Number

LastIndexOf(Text, Number)

Returns the zero-based index of the last occurrence of the specified text in this instance.  The search will start at the specified character position.

Number

LastIndexOf(Text, Number, Number)

Returns the zero-based index of the last occurrence of the specified text in this instance.  The search will start at the specified character position and examines the specified number of positions.

Number

Length

Returns the number of characters in this instance.

Number Split([' ',',',';','(',')','-'], "RemoveEmptyEntries").Length Returns the number of words in this instance. Note: In this case, spaces, commas, semicolons, parenthesis, and dashes are considered word separators. You can adjust this for your needs.

Text

PadLeft(Number)

Returns a new text which is right-aligned and padded on the left with spaces for a specified total length.

Text

PadLeft(Number, Text)

Returns a new text which is right-aligned and padded on the left with a specified character for a specified total length.

Text

PadRight(Number)

Returns a new text which is left-aligned and padded on the right with spaces for a specified total length.

Text

PadRight(Number, Text)

Returns a new text which is left-aligned and padded on the right with a specified character for a specified total length.

Text

Remove(Number)

Returns a new text in which all characters of this instance after the specified number has been removed.

Text

Remove(Number, Number)

Returns a new text in which all characters of this instance after the specified number has been removed, for a specified length.

Text

Replace(Text, Text)

Returns a new text where all instances of a text have been replaced with a new text.

Text[]

Split(Text)

Returns a text array which contains substrings of this instance separated by any character in the specified character array.

Text[]

Split(Text, Number)

Returns a text array which contains substrings of this instance separated by any character in the specified character array.  A specified maximum number of substring will be returned.

Yes/No

StartsWith(Text)

Returns whether the beginning of this instance starts with the specified text.

Text

Substring(Number)

Returns a substring of this instance starting at the specified character position and until the end of this instance.

Text

Substring(Number, Number)

Returns a substring of this instance starting at the specified character position and until the specified length.

Text

ToLower()

Returns a copy of this instance converted to lowercase.

Text

ToUpper()

Returns a copy of this instance converted to uppercase.

Text

Trim()

Removes all leading and trailing white-space characters from the current instance.

Text

Trim()

Removes all leading and trailing occurrences of the specified set of characters from the current instance.

Text

TrimEnd()

Removes all trailing occurrences of the specified set of characters from the current instance.

Text

TrimStart()

Removes all leading occurrences of the specified set of characters from the current instance.

 

 

Printable View