/*
Min and Max string left message
515069
function isLength(validationItem) {
    switch (validationItem.params.length) {

      case 1:
        return 'Please enter a value with at least ' + validationItem.params[0] + ' character' + (validationItem.params[0] != 1 ? 's' : '');
        break;

      case 2:
        return 'Please enter a value between ' + validationItem.params[0] + ' and ' + validationItem.params[1] + ' characters long';
        break;

      default:
        return errorMessages['default'];
        break;

    }

    return errorMessage;
  }
1228683
function(strings) {
			var lengths = strings.map(function(s) {
				return typeof s === 'string' ? s.length : +s;
			});
			
			var max = lengths.reduce(function(prev, cur) {
				return typeof prev === 'undefined' ? cur : Math.max(prev, cur);
			});
			return lengths.map(function(l) {
				var pad = max - l;
				return pad ? this.repeatString(' ', pad) : '';
			}, this);
		}
438872
function leftPad(n, prefix, maxN) {
  const s = n.toString();
  const nchars = Math.max(2, String(maxN).length) + 1;
  const nspaces = nchars - s.length - 1;

  return prefix + ' '.repeat(nspaces) + s;
}
1295288
function (value, min, max) {
        value = parseInt(value, 10);
        min = min | 0;
        if (isNaN(value) || value < min) {
            return false;
        }
        if (max && value > max) {
            return false;
        }
        return true;
    }
379622
private void addMinMax(String chars) {
        for (int i = 0; i < chars.length(); i++) {
            int c = chars.codePointAt(i);
            if (min == -1 || min > c) {
                min = c;
            }
            if (max == -1 || max < c) {
                max = c;
            }
        }
    }
1133300
function maxlength (val, max) {
  if (typeof val === 'string') {
    return isInteger(max, 10) && val.length <= parseInt(max, 10)
  } else if (Array.isArray(val)) {
    return val.length <= parseInt(max, 10)
  } else {
    return false
  }
}
101593
public static String randomAsciiRandomLength(int minLength, int maxLength) {
		return RandomStringUtils.random(nextInt(minLength, maxLength), 32, 127, false, false, null,
				threadLocalRandom());
	}
1150326
function $asStringSmall (str) {
  var result = ''
  var last = 0
  var found = false
  var surrogateFound = false
  var l = str.length
  var point = 255
  for (var i = 0; i < l && point >= 32; i++) {
    point = str.charCodeAt(i)
    if (point >= 0xD800 && point <= 0xDFFF) {
      // The current character is a surrogate.
      surrogateFound = true
    }
    if (point === 34 || point === 92) {
      result += str.slice(last, i) + '\\'
      last = i
      found = true
    }
  }

  if (!found) {
    result = str
  } else {
    result += str.slice(last)
  }
  return ((point < 32) || (surrogateFound === true)) ? JSON.stringify(str) : '"' + result + '"'
}
717041
function( tmp ) {
      var _length = tmp.val.length;
      return _length === 0 || _length >= tmp.arg || messages.minLength.replace( '{count}', tmp.arg );
    }
1125782
public static String left(EvaluationContext ctx, Object text, Object numChars) {
        int _numChars = Conversions.toInteger(numChars, ctx);
        if (_numChars < 0) {
            throw new RuntimeException("Number of chars can't be negative");
        }

        return StringUtils.left(Conversions.toString(text, ctx), _numChars);
    }
43088
public function isValidStringLength($str, $min = null, $max = null): bool
    {
        $len = mb_strlen($str, 'UTF-8');

        return (($min !== null) && ($len >= $min)) || (($max !== null) && ($len <= $max));
    }
1302527
function maxstache (str, ctx) {
  ctx = ctx || {}

  assert.equal(typeof str, 'string')
  assert.equal(typeof ctx, 'object')

  const tokens = str.split(/\{\{|\}\}/)
  const res = tokens.map(parse(ctx))
  return res.join('')
}
152313
function leftPad(value, length) {
  const total = !length ? 0 : length;

  let padded = value + '';

  while (padded.length < total) {
    padded = '0' + padded;
  }

  return padded;
}
564487
public static void checkMinMax(int min, int max) {
    checkMin(min);
    checkMax(max);
    checkArgument(min <= max, "min > max");
  }
895226
public static function isLength($value, $min = 0, $max = 0)
    {
        $value = trim($value);
        if (!is_string($value)) {
            return false;
        }
        $length = function_exists('mb_strlen') ? mb_strlen($value, 'UTF-8') : strlen($value);

        if (is_array($min)) {
            $max = $min[1];
            $min = $min[0];
        }
        if ($min != 0 && $length < $min) return false;
        if ($max != 0 && $length > $max) return false;
        return true;
    }
852880
function (low, high, max) {
            var length = high - low;

            if (length < 0) {
                return {
                    min: -1,
                    max: -1
                };
            }

            low = util.clamp(low, 0, max);
            high = util.clamp(low + length, 0, max);
            if (high - low < length) {
                low = util.clamp(high - length, 0, max);
            }
            return {
                min: low,
                max: high
            };
        }
521382
function short(str, max)
			{
				if (str.length > max)
				{
					str = str.substring(0, Math.round(max / 2)) + '...' +
						str.substring(str.length - Math.round(max / 4));
				}
				
				return str;
			}