Skip to main content

Length range

The length of the text associated with the given (key) shall be within a specified range.

Parameter table​

paramunitrequireddescription
keyyesThe key of the text to check for length.
mincharnoThe minimum length allowed.
maxcharnoThe maximum length allowed.
applyCorrectionnoWhether to apply the correction.

Correction​

The correction is implemented on the provided (key), the correction can only be done if the text is longer than the maximum length. 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 as it doesn't make sense to remove characters from it. So, any text with length smaller than 10 will not be corrected even if it is greater than the maximum length.

How to setup​

The rule verifies whether the text associated with the specified (key) is within the specified range defined by the minimum (min) and maximum (max) lengths. If the text is not within the specified range, the rule will fail.

Examples​

valuevalidmaxmindescription
Lyon❌6The text is shorter than the minimum length.
Aix-en-Provence✅6The text is longer than the minimum length.
The weather is nice today.❌10The text is longer than the maximum length.
Mercedes✅10The text is shorter than the maximum length.
hi there✅105The text is within the specified range.
hello✅55The text is within the specified range.
hi❌105The text is shorter than the minimum length.
The weather is nice today.❌105The text is longer than the maximum length.