max must be a 0 or positive number string
331922
function checkMax(value, max) {
  if (max) {
    if (max.charAt(0) === '-') {
      if (value.charAt(0) !== '-')
        return false;
      return checkMax(max.substr(1), value.substr(1));
    } else {
      if (value.charAt(0) === '-')
        return true;
    }
    var len = Math.max(value.length, max.length);
    max = left0pad(max, len);
    value = left0pad(value, len);
    return value <= max;
  }
  return true;
}
441280
def _digits(minval, maxval):
    """"""
    if minval == maxval:
        return 3
    else:
        return min(10, max(2, int(1 + abs(np.log10(maxval - minval)))))
1253758
static boolean isCOctetStringValid(String value, int maxLength) {
        if (value == null)
            return true;
        if (value.length() >= maxLength)
            return false;
        return true;

    }
340400
def validate_maximum(value, maximum, is_exclusive, **kwargs):
    
    if is_exclusive:
        comparison_text = "less than"
        compare_fn = operator.lt
    else:
        comparison_text = "less than or equal to"
        compare_fn = operator.le

    if not compare_fn(value, maximum):
        raise ValidationError(
            MESSAGES['maximum']['invalid'].format(value, comparison_text, maximum),
        )
140634
def length(min=None, max=None):
    

    def validate(value):
        if min and len(value) < min:
            return e("{} does not have a length of at least {}", value, min)
        if max and len(value) > max:
            return e("{} does not have a length of at most {}", value, max)
    return validate
823597
function calculateMaxLength(value) {
                var length = 16;
                if (!angular.isUndefined(value)) {
                    length = Math.floor(value).toString().length;
                }
                if (decimals > 0) {
                    // Add extra length for the decimals plus one for the decimal separator.
                    length += decimals + 1; 
                }
                if (min < 0) {
                    // Add extra length for the - sign.
                    length++;
                }
                return length;
            }
549578
def _validate_int(name, value, limits=(), strip='%'):
    '''
    
    '''
    comment = ''
    # Must be integral
    try:
        if isinstance(value, string_types):
            value = value.strip(' ' + strip)
        value = int(value)
    except (TypeError, ValueError):
        comment += '{0} must be an integer '.format(name)
    # Must be in range
    else:
        if len(limits) == 2:
            if value < limits[0] or value > limits[1]:
                comment += '{0} must be in the range [{1[0]}, {1[1]}] '.format(name, limits)
    return value, comment
406564
function (str) {
            
            var typeOf = typeof str;
            if (typeOf === 'number')
                return str;
            
            else if (typeOf !== 'string')
                return Number.NaN;
            
            else if (_floatRegex.test(str))
                return parseFloat(str);
                
            else if (   str === 'Infinity'
                     || str === '+Infinity' )
                return Number.POSITIVE_INFINITY;
            
            else if (str === '-Infinity')
                return Number.NEGATIVE_INFINITY;
            
            else  // whether "NaN" or any other string
                return Number.NaN;
        }
442491
protected function validate_positive_int( $var, $include_zero = false, $min = null, $max = null ) {
		$validate = $this->validate_int( $var, $min, $max );
		if ( true === $validate ) {
			return $this->validate_positive( $var, $include_zero );
		}

		return $validate;
	}
1325608
private function max($value, $max)
    {
        if (is_string($value)) {
            $value = strlen($value);
        }

        return $value <= $max;
    }
193363
public static boolean isLimited(String string, int min, int max) {
        return isNotEmpty(string) && string.length() >= min && string.length() <= max;
    }
1195239
def strictly_positive_int_or_none(val):
    """"""
    val = positive_int_or_none(val)
    if val is None or val > 0:
        return val
    raise ValueError('"{}" must be strictly positive'.format(val))
538480
public void expectMax(String name, double maxLength) {
        expectMax(name, maxLength, messages.get(Validation.MAX_KEY.name(), name, maxLength));
    }
854167
function verifuint (value, max) {
  if (typeof value !== 'number') throw new Error('cannot write a non-number as a number')
  if (value < 0) throw new Error('specified a negative value for writing an unsigned value')
  if (value > max) throw new Error('RangeError: value out of range')
  if (Math.floor(value) !== value) throw new Error('value has a fractional component')
}
301893
static boolean isOctetStringValid(String value, int maxLength) {
        if (value == null)
            return true;
        if (value.length() > maxLength)
            return false;
        return true;
    }
1155535
private int parseDMax(String dMaxString) {
		int dMax;
		try {
			dMax = Integer.parseInt(dMaxString);
		} catch (NumberFormatException e) {
			dMax = 0;
		}
		return dMax;
	}
917294
function (value, min, max) {
        min = min | 0;
        let length = ((value || '') + '').length;
        if (length < min) {
            return false;
        }
        if (max && length > max) {
            return false;
        }
        return true;
    }