HotDocs Models: mid(text, num, 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 number you type. This number specifies where HotDocs starts "returning" characters.
num A number value, such as a Number variable or a number you type. It specifies the number of characters you want returned.

Like the first and last expressions, this expression extracts a specified number of characters from within a text string.

For example, you may be required to split the Text variable, TelephoneNumber (with the telephone number pattern) into three pre-formatted fields—the area code, the prefix, and the number. In the following example, three different computations would be scripted as follows:

mid( TelephoneNumber, 2, 3 )

mid( TelephoneNumber, 7, 3 )

last( TelephoneNumber, 4 )

The first computation, which you would place in the area code field, tells HotDocs to include three characters, starting with the second character (this takes into consideration the opening parenthesis.)

The second computation (the prefix field) starts at the seventh character (again, taking into account the parentheses and space characters between the area code and the prefix), and inserts the next three characters.

The third expression, which uses the last expression, returns the last four digits of the phone number by counting backwards from the last character.