The TEXT ENDS WITH TEXT operator returns a value of true if the first text value ends with the second text value.
You can use this operator, which returns a true/false value, as a condition for IF statements.
Operator | Model | After you drag and drop the model into the script tab: | Expression returns: |
ENDS WITH | ⟦TEXT⟧ ENDS WITH ⟦TEXT⟧ | Replace the first ⟦TEXT⟧ placeholder with the text that you want checked. Replace the second ⟦TEXT⟧ placeholder with the pattern you are checking for. | A true/false value. |
Assume you have a template that uses serial numbers for parts. The serial number has a suffix to identify a quantity that the parts are bundled in. You could use the TEXT ENDS WITH TEXT operator to check the serial number for the suffix:
IF (SerialNumberTE ENDS WITH "12"
//part is bundled in sets of 12
END IF
After you download the example template, you can import the template to any workspace to see this example code in action.