On 20 August 2018 at 16:26, Lodewyk <[email protected]> wrote:
> Hi,
>
> I would like to extend StringUtils. I looked through the GitHub repository
> and it was suggested that I check if the intended feature falls within the
> scope of Apache Commons Lang first.
>
> I intend on adding a function that will return either true or false if the
> length of a String is between a specified interval.
What if the string is null?
> Example Function Descriptor:
>
>> public boolean isLengthBetween(int begin, int end, String str)
>
>
> This will cut out the need for having to test the length of a String as
> follows:
>
>> if (name.length() < 3 || name.length() > 32) {
>> throw new IllegalArgumentException();
>> }
>>
>
> With the intended addition:
>
>> if (!isLengthBetween(3, 32)) {
Missing string parameter?
>> throw new IllegalArgumentException();
>> }
>
>
> Thank you.
Seems to me it would be better to have a generic range checker that
operates on the string length, rather than a special-purpose method
just for strings.
> Kind Regards,
> Jacobus Lodewicus
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]