HotDocs Models: last( text, num )

Placeholder Replace With
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 A number value, such as a Number variable or a fixed number value. It specifies the number of characters you want returned.

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( SocialSecurityNumber, 4 )

In the next example, the user wants to make the answer to item TE 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( ItemName, 1 ) = "s"

or last( ItemName, 1 ) = "z"

ItemName + "es"

else ItemName + "s"

endIf

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.