/*
Check like score and convert to integer if not.

## Args
value: Like score to be checked.

## Returns
Integer value.
6241
function check_like_score(value) {
    if (value != null) {
        const res = parseInt(value, 10);
        if (!isNaN(res)) {
            return res;
        }
    }
    return 0;
}
67072
def to_int(value: Any) -> int:
        

        if isinstance(value, (bool, int)):
            return int(value)
        return int(str(value))
1049942
public static final int getInt(String value)
   {
      return (value == null || value.length() == 0 ? 0 : Integer.parseInt(value));
   }
225576
def positive_int(value: str) -> int:
    
    try:
        ivalue = int(value)
        assert ivalue > 0
    except (AssertionError, TypeError, ValueError):
        raise ArgumentTypeError(
            "{!r} is an invalid positive int".format(value))
    return ivalue
726555
def validate_integer(option, value):
    
    if isinstance(value, integer_types):
        return value
    elif isinstance(value, string_type):
        try:
            return int(value)
        except ValueError:
            raise ValueError("The value of %s must be "
                             "an integer" % (option,))
    raise TypeError("Wrong type for %s, value must be an integer" % (option,))
994816
public static UInteger valueOf(String value) throws NumberFormatException {
        return valueOfUnchecked(rangeCheck(Long.parseLong(value)));
    }
430148
static Integer integer(String value) {
        Integer result;
        if (value != null) {
            value = value.trim();
            Matcher matcher = INTEGER_PATTERN.matcher(value);
            if (matcher.matches()) {
                result = Integer.parseInt(matcher.group(1).replace(" ", ""));
            } else {
                throw new IllegalArgumentException("Unknown format for value: " + value);
            }
        } else {
            result = null;
        }
        return result;
    }
902924
public IntegerConstant getIntegerByValue(int value)
  {
    for (int i = 0; i < _entries.size(); i++) {
      ConstantPoolEntry entry = _entries.get(i);

      if (! (entry instanceof IntegerConstant))
        continue;

      IntegerConstant integerEntry = (IntegerConstant) entry;

      if (integerEntry.getValue() == value)
        return integerEntry;
    }

    return null;
  }
359866
def convert(self, value, param, ctx):
        
        value = super(PositiveInt, self).convert(value, param, ctx)
        if value < 0:
            self.fail('%s is not positive' % value, param, ctx)
        if not self.allow_zero and not value:
            self.fail('%s is not greater than 0' % value, param, ctx)
        return value
158635
public static String getSInt( int Value ) {
		//
		String Result = "";
		//
		Result = String.format( "%d", Value );
		//
		return Result;
	}
510524
function(value, hint) {
	if (hint) {
		var hintParser = this[hint[0].toUpperCase() + hint.slice(1)];
		if (hintParser) {
			return hintParser(value);
		}
	}

	var numberValue = Number(value);
	if (!isNaN(numberValue)) {
		return numberValue;
	}

	var lowerValue = value.toLowerCase();
	if (lowerValue === "true") {
		return true;
	}
	else if (lowerValue === "false") {
		return false;
	}

	return value;
}
240640
protected boolean valueCheck(double value, String simpleRange) {
		if (simpleRange.isEmpty()) {
			return false;
		}

		if (simpleRange.endsWith(":")) {
			return value < Double.parseDouble(simpleRange.replace(":", ""));

		}

		if (simpleRange.startsWith("~:")) {
			return value > Double.parseDouble(simpleRange.replace("~:", ""));

		}

		if (simpleRange.startsWith("@")) {
			String[] values = simpleRange.replace("@", "").split(":");
			return value >= Double.parseDouble(values[0]) && value <= Double.parseDouble(values[1]);
		}

		if (simpleRange.matches("^-{0,1}[0-9]+:-{0,1}[0-9]+$")) {
			String[] values = simpleRange.split(":");
			return value < Double.parseDouble(values[0]) || value > Double.parseDouble(values[1]);
		}

		return simpleRange.matches("^-{0,1}[0-9]+$") && (0 > value || value > Double.parseDouble(simpleRange));
	}
1333241
def check_positive_integer(name, value):
    
    try:
        value = int(value)
        is_positive = (value > 0)
    except ValueError:
        raise ValueError('%s should be an integer; got %r' % (name, value))

    if is_positive:
        return value
    else:
        raise ValueError('%s should be positive; got %r' % (name, value))
712165
function intcheck(min, max) {
  //--int i;
  var i;
  i=this.intValueExact(); // [checks for non-0 decimal part]
  // Use same message as though intValueExact failed due to size
  if ((i<min)||(i>max))
   throw "intcheck(): Conversion overflow: "+i;
  return i;
  }
892619
def validate(self, value: int):
        '''  '''
        if not isinstance(value, int):
            raise ValueError('value is not an integer')

        if self.minimum > value or self.maximum < value:
            msg = (
                '{} is outside the valide range [{},{}]'
            ).format(value, self.minimum, self.maximum)
            raise ValueError(msg)
1144202
def is_valid_int(value):
        """"""
        if 0 <= value <= Parameter.MAX:  # This includes ON and OFF
            return True
        if value == Parameter.UNKNOWN_VALUE:
            return True
        if value == Parameter.CURRENT_POSITION:
            return True
        return False
829362
public static Integer checkNull(Integer value, int elseValue) {
        return checkNull(value, Integer.valueOf(elseValue));
    }