The TEXT STARTS WITH TEXT operator returns a value of true if the first text value starts 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: |
STARTS WITH | ⟦TEXT⟧ STARTS 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 and that the serial number has a prefix to identify the part type. You can use the TEXT STARTS WITH TEXT operator to check the serial number for the prefix:
IF (SerialNumberTE STARTS WITH "S18")
//this part is a screw
END IF
After you download the example template, you can import the template to any workspace to see this example code in action.