Text operators
Text operators define conditions based on strings.
| Operator | Description | Example |
|---|---|---|
| <text> contains <text> | Tests that a string contains another string. | if the name of the customer contains “Smith” then... |
| <text> does not contain <text> | Tests that a string does not contain another string. | if the name of the customer does not contain “Smith” then... |
| <text> does not end with <text> | Tests that a string does not end with another string. | if the rental agreement code of the customer does not end with “XG5” then... |
| <text> does not start with <text> | Tests that a string does not start with another string. | if the rental agreement code of the customer does not start with “XG5” then... |
| <text> ends with <text> | Tests that a string ends with another string. | if the rental agreement code of the customer ends with “XG5” then... |
| <text> is empty | Tests that a string is empty. An empty string contains no characters and is equivalent to ““. A string is not empty if it contains a space (“ “) | if the rental agreement code of the customer is empty then... |
| <text> is not empty | Tests that a string is not empty. A string is not empty if it contains a space (“ “) | if the rental agreement code of the customer is not empty then... |
| print <text> | Prints a string to standard out. | if... then print the message “Hello World” |
| <text> starts with <text> | Tests that a string starts with another string. | if the rental agreement code of the customer starts with “XG5” then... |
| the length of <text> | Returns the number of characters in a string. | if the length of ’customer name’ is more than 3 then... |