Java String Length Get lengthCheck(final String str, final int minLength, final int maxLength)

Here you can find the source of lengthCheck(final String str, final int minLength, final int maxLength)

Description

Check the length of the string str using the minimum and maximum values provided.

License

Open Source License

Parameter

Parameter Description
str string to check
minLength the minimum length
maxLength the max length

Return

true if the str is between the constraints, false if it violates them.

Declaration

public static boolean lengthCheck(final String str, final int minLength, final int maxLength) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   www . j  a v  a2 s  .  c om
     * Check the length of the string str using the minimum and maximum values provided.
     *
     * @param str       string to check
     * @param minLength the minimum length
     * @param maxLength the max length
     * @return true if the str is between the constraints, false if it violates them.
     */
    public static boolean lengthCheck(final String str, final int minLength, final int maxLength) {
        int len = str.length();
        return len >= minLength && len <= maxLength;
    }
}

Related

  1. length(String string)
  2. length(String string)
  3. length(String... args)
  4. lengthBetween(String param, int minLength, int maxLength)
  5. lengthByteInPrepared(String s)
  6. lengthConstToString(int val, int len)
  7. LengthConversionFactor(String OldUnits)
  8. lengthExpandedTabs(String string, int toIdx, int tabWidth)
  9. lengthExpression(final String operand, final long length)