Placeholder | Replace With |
text | A text value, such as a Text variable |
text | A text value, such as a Text variable. Any text you type must be in quotation marks. |
The text contains text expression determines whether the first text value contains the same text as the second value. If it does, it returns the value of true.
In this example, some states in the United States are officially recognized as “commonwealth” states. In the following script, HotDocs examines the answer the user provides for the variable StateName to see if the user has listed one of these states. If so, HotDocs attaches the correct designation to the merged answer:
if "massachusetts virginia kentucky pennsylvania" contains StateName
"The Commonwealth of [StateName;te ]"
else
"The State of [StateName;te]"
endIf
At first glance, this computation may seem backward. You may think you would test StateName to see if it contains any of the commonwealths listed in the text string (for example, if StateName contains "massachusetts virginia kentucky pennsylvania"). However, if you used that method, the answer the user assigns to StateName would have to contain everything between the quotation marks—"massachusetts virginia kentucky pennsylvania"—and you would never produce a true statement. Of course, you could test StateName against each individual commonwealth (for example, if StateName contains "massachusetts" or if StateName contains "virginia" and so forth), but by "switching" the values for the placeholders and placing all of the commonwealths in one text string, you eliminate a lot of repetitive typing.