The «Trim()» function will strip white space or other characters from either side of a value.
“White Space” includes the space character but also other characters (like the tab or new line characters) which are used to format output but when printed are not visible.
For example, suppose you want to test that a field is empty, but sometimes that field might contain spaces and you want that data element to be regarded as empty when it contains only spaces. The condition in the command «If(Name = “”)» will be false if the data element Name consists only of spaces. Using Trim as follows achieves what is required:
«If(Trim(Name) = "")»
Suppose the template interview contains a field (e.g. “Clause”) which the user is required to enter. Usually clauses end in a full stop (period), but perhaps users forget to include this. Rather than failing the input when it does not contain a period, rather trim the period from the input and have the period hard-coded in the document, like this: