Max length
The text of the given (key
) shall not be longer than the specified (maxLength
).
Parameter table
param | unit | required | description |
---|---|---|---|
key | yes | The key of the value to check for length. | |
maxLength | char | yes | The maximum length allowed. |
applyCorrection | no | Whether to apply the correction. |
Correction
The correction is implemented on the provided (key
), wherein the text is transformed into a new one with a length
three characters less than the specified (maxLength).
This transformation includes the concatenation of ..., signifying that
the text exceeded the designated length and underwent correction.
There are cases where we won't be performing the described correction on the text.
These cases are when the text is generally small so it wouldn't make sense to remove characters from it.
The minimum length for the correction to be applied is 10 characters.
- Example: if the maximum length is 10 and the text is "The weather is nice today." then the text will be sliced to "The wea..."
How to setup
The rule verifies whether the text associated with the specified (key
)
is shorter than the specified (maxLength
).
If the text is longer than the specified length, the rule will fail.
Examples
value | valid | maxLength | description |
---|---|---|---|
hello | ✅ | 10 | The text is shorter than the maximum length. |
The weather is nice today. | ❌ | 10 | The text is longer than the maximum length. |