📜TSL Comparators
Which comparation operators does TSL support?
Comparators are part of the predicates. They basically compare left-hand (which are properties)
with right-hand (which are literal values)
.
Comparator: Arithmetical
Arithmetical comparators are classical operators comparing values by their magnitudes. These kind of comparators require numeric values or string words as right-hand values
.
For numeric values, anything accepted by Java is also accepted by arithmetical comparators. (E.g 1
, 1.0
, 1.0f
, 1.0d
)
Equals ( = )
Greater than ( > )
Less than ( < )
Equal or Greater than ( >= )
Equal or Less than ( <= )
Comparator: IS
IS comparator checks if left-hand value
is equal to the right-hand value
char by char.
Comparator: PREFIX
PREFIX comparator checks if left-hand value
starts with given right-hand value
.
Comparator: POSTFIX
POSTFIX comparator checks if left-hand value
ends with given right-hand value
.
Comparator: IN RANGE
IN RANGE comparator checks if left-hand value
is in a certain number range. Right-hand value
must be a valid range expression, which is basically two numeric values seperated by a comma inside square brackets.
Any right-hand value
not matching mentioned format counts as malformed, and interpreted as a syntax error by the mod. Moreover, since right-hand value
MUST be only one word, SPACE character put inbetween also counts as malformed. Exemplar values:
❌100,200
# Missing square brackets
❌[100, 200]
# Containing SPACE character inbetween
✅[100,200]
# One word, perfect!
Comparator: CONTAINS
CONTAINS comparator checks if left-hand value
contains given value
Last updated