Begins With and Ends With Rules¶
These rules verify that a property begins or ends with a certain value. An optional range parameter can be added to specify the starting index position and property length.
Note: This check is case sensitive.
Begins With ¶
This rule verifies that a property begins with a specified value.
Syntax
1 2 3 4 5 | check <property String> begins with <value String>; check <property String> begins with <value String> if present; check <property String> begins with <value String> <rangeFrom Number>:<rangeLength Number>; check <property String> begins with <value String> <rangeFrom Number>:<rangeLength Number> if present; |
-
property - The property being checked.
-
value - The value that the property should start with. If the ticket's property value is empty, the Rule will fail.
-
rangeFrom (Optional) - The starting index position of the value. Counting starts from position
0
. -
rangeLength (Optional) - The length of characters being checked.
Example
1 2 3 4 5 | check "RECORD_TYPE" begins with "abc"; check "RECORD_TYPE" begins with "abc" if present; check "RECORD_TYPE" begins with "defgabc" 4:3; check "RECORD_TYPE" begins with "defgabc" 4:3 if present; |
Note: If rangeFrom
and rangeLength
are larger than the string length, the rule will fail with the message Could not execute rule: String index out of range.
Additional Examples
Property Value | Rule Parameter | Check Result |
---|---|---|
"Session" |
"DataSession12" 4:7 |
OK |
"Session" |
"DataSession12" |
FAIL |
"Cost for SMS" |
"Cost" |
OK |
"Cost for SMS" |
"cost" |
FAIL |
Ends With ¶
Verifies that a property ends with a certain value.
Syntax
1 2 | check <property String> ends with <value String>; check <property String> ends with <value String> if present; |
-
property - The property being checked.
-
value - The value that the property should end with. If the ticket's property value is empty, the Rule will fail.
-
rangeFrom (Optional) - The starting index position of the value. Counting starts from position
0
. -
rangeLength (Optional) - The length of characters being checked.
Example
1 2 3 4 5 | check "RECORD_TYPE" ends with "abc"; check "RECORD_TYPE" ends with "abc" if present; check "RECORD_TYPE" ends with "defgabc" 4:2; check "RECORD_TYPE" ends with "defgabc" 4:2 if present; |
Note: If rangeFrom
and rangeLength
are larger than the string length, the rule will be failed with the message Could not execute rule: String index out of range.
Additional Examples
Property Value | Rule Parameter | Check Result |
---|---|---|
"VoiceFlat" | "VoiceFlat" | OK |
"DataSession" | "Session" | OK |
"Cost for SMS" | "SMS" | OK |
"Cost for SMS" | "sms" | FAIL |