[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Request to extend StringUtils: Check String length falls within interval


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.

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

> if (name.length() < 3 || name.length() > 32) {
>     throw new IllegalArgumentException();
> }

With the intended addition:

> if (!isLengthBetween(3, 32)) {
>      throw new IllegalArgumentException();
> }

Thank you.

Kind Regards,
Jacobus Lodewicus