StringLengthCompare condition

Compares the length of a string with a set length.

Parameters

Attribute Description Required
string The string to compare. Yes
op The comparison operator. One of: <=, <, ==, >, >= Yes
length The length to compare against. Yes
trim Whether the string should be trimmed before validation. No; Defaults to false

Examples

The following example checks whether ${source.dir} is an empty string after trimming and sets the emptyString property if the condition is true.
<condition property="emptyString">
    <stringLengthCompare string="${source.dir}" op="==" length="0" trim="true" />
</condition>