LAST( TEXT, NUM )

Placeholder Tooltip Replace With
TEXT in: Text A text value, such as a Text variable, from which the specified number of characters will be returned. This can be a fixed text value, inside quotation marks.
NUM count: Number A number value, such as a Number variable or a fixed number value. It specifies the number of characters you want returned.

Returns a Text value

The LAST expression finds and returns a certain number of characters from the end of a text string.

For example, the following text computation returns the last four digits of a Social Security number:

LAST( Social Security Number, 4 )

In the next example, the user wants to make the answer to Item Type plural. Using the LAST expression, HotDocs checks to see if the last letter in the value is a specific letter. If so, HotDocs inserts the correct plural suffix.

IF LAST( Item Type, 1 ) = "s" OR LAST( Item Type, 1 ) = "z"

Item Type + "es"

ELSE

Item Type + "s"

END IF

This example script does not take into consideration words that end in “y” or “x” or any other letter that would cause yet a different result. It is only shown here in its most basic form to demonstrate how the LAST expression functions.