converts a symbolic char to a number in the given base
        returns expression, result
        expression is a symbolic boolean indicating whether or not it was a valid number
        result is the value
767193
def _char_to_val(char, base):
        
        cases = []
        # 0-9
        max_digit = claripy.BVV(b"9")
        min_digit = claripy.BVV(b"0")
        if base < 10:
            max_digit = claripy.BVV(ord("0") + base, 8)
        is_digit = claripy.And(char >= min_digit, char <= max_digit)
        # return early here so we don't add unnecessary statements
        if base <= 10:
            return is_digit, char - min_digit

        # handle alphabetic chars
        max_char_lower = claripy.BVV(ord("a") + base-10 - 1, 8)
        max_char_upper = claripy.BVV(ord("A") + base-10 - 1, 8)
        min_char_lower = claripy.BVV(ord("a"), 8)
        min_char_upper = claripy.BVV(ord("A"), 8)

        cases.append((is_digit, char - min_digit))
        is_alpha_lower = claripy.And(char >= min_char_lower, char <= max_char_lower)
        cases.append((is_alpha_lower, char - min_char_lower + 10))
        is_alpha_upper = claripy.And(char >= min_char_upper, char <= max_char_upper)
        cases.append((is_alpha_upper, char - min_char_upper + 10))

        expression = claripy.Or(is_digit, is_alpha_lower, is_alpha_upper)
        # use the last case as the default, the expression will encode whether or not it's satisfiable
        result = claripy.ite_cases(cases[:-1], cases[-1][1])

        return expression, result
691431
def to_decimal(number, strip='- '):
    '''
    
    '''
    if isinstance(number, six.integer_types):
        return str(number)

    number = str(number)
    number = re.sub(r'[%s]' % re.escape(strip), '', number)

    # hexadecimal
    if number.startswith('0x'):
        return to_decimal(int(number[2:], 16))

    # octal
    elif number.startswith('o'):
        return to_decimal(int(number[1:], 8))

    # binary
    elif number.startswith('b'):
        return to_decimal(int(number[1:], 2))

    else:
        return str(int(number))
883094
function (mixed, base) {
            var type = typeof mixed;

            base = base || 10;

            if (type === "boolean") {
                return +mixed;

            } else if (type === "string") {
                mixed   = mixed.replace(/\s/g, "");
                var tmp = parseInt(mixed, base);
                return (isNaN(tmp) || !isFinite(tmp)) ? 0 : tmp;

            } else if (type === "number" && isFinite(mixed)) {
                /* jshint -W016 */
                return mixed | 0;
                /* jshint +W016 */

            } else {
                return 0;
            }
        }
294163
public NumberExpression<T> abs() {
        if (abs == null) {
            abs = Expressions.numberOperation(getType(), MathOps.ABS, mixin);
        }
        return abs;
    }
854432
def to_number(s):
    
    ret = s
    # try converting to float
    try:
        ret = float(s)
    except ValueError:
        ret = ret.strip('\'').strip()

    # try converting to uid
    try:
        ret = int(s)
    except ValueError:
        pass

    # try converting to boolean
    if ret == 'True':
        ret = True
    elif ret == 'False':
        ret = False
    elif ret == 'None':
        ret = None
    return ret
954714
public static int
value(String s, boolean numberok) {
	int val = types.getValue(s);
	if (val == -1 && numberok) {
		val = types.getValue("TYPE" + s);
	}
	return val;
}
539140
def cast_to_number_or_bool(inputstr):
    
    if inputstr.strip().lower() == "true":
        return True
    elif inputstr.strip().lower() == "false":
        return False
    try:
        return int(inputstr)
    except ValueError:
        try:
            return float(inputstr)
        except ValueError:
            return inputstr
694819
def _isint(string):
    
    return type(string) is int or \
           (isinstance(string, _binary_type) or isinstance(string, _text_type)) and \
           _isconvertible(int, string)
257338
public static boolean isAllNumber(String str) {
    	boolean hasNumber = false;
		for (int i = 0; i < str.length(); i++) {
		    if (!(Character.isDigit(str.charAt(i)) || 
				str.charAt(i) == '.' || str.charAt(i) == ',' || str.charAt(i) == '%'
				|| str.charAt(i) == '$' || str.charAt(i) == '_')) {
			return false;
		    }
		    else if (Character.isDigit(str.charAt(i)))
		    	hasNumber = true;
		}
		
		if (hasNumber == true)
			return true;
		else return false;		
    }
1040761
static boolean isAlphanum(int c) {
		return ( (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || 
				 (c >= 'A' && c <= 'Z') || c == '_' || c == '$' || c == '\\' || 
				 c > 126);
	}
817263
def StrictlyAlphanumeric(msg=None):
    '''
    
    '''
    def fn(value):
        if not (
            isinstance(value, basestring) and
            value.isalnum() and not
            value.isdigit() and not
            value.isalpha()
        ):
            raise Invalid(msg or (
                'Invalid input <{0}>; expected an integer'.format(value))
            )
        else:
            return value
    return fn
672513
@Override
    public <N extends Number> Expression<N> abs(Expression<N> arg0)
    {
        // TODO Auto-generated method stub
        return null;
    }
167298
def __convert_key(expression):
        
        if type(expression) is str and len(expression) > 2 and expression[1] == '!':
            expression = eval(expression[2:-1])
        return expression
630083
function __isNumber(number) {
			if (!isChar(number)) invaildCharacter(number);
			var code = number.charCodeAt(0);
			return code >= ZERO && code <= NINE;
		}
1205577
function toAlphabet(num, alphabet) {
				var base = alphabet.length;
				var digits = [];	// these will be in reverse order since arrays are stacks

				// execute at least once, even if num is 0, since we should return the '0':
				do {
					digits.push(num % base);	// TODO handle negatives properly?
					num = Math.floor(num / base);
				} while (num > 0);

				var chars = [];
				while (digits.length) {
					chars.push(alphabet[digits.pop()]);
				}
				return chars.join('');
			}
246666
def convert_string_to_number(value):
    
    if value is None:
        return 1
    if isinstance(value, int):
        return value
    if value.isdigit():
        return int(value)
    num_list = map(lambda s: NUMBERS[s], re.findall(numbers + '+', value.lower()))
    return sum(num_list)
953062
def _to_base36(number):
    
    if number < 0:
        raise ValueError("Cannot encode negative numbers")

    chars = ""
    while number != 0:
        number, i = divmod(number, 36)  # 36-character alphabet
        chars = _alphabet[i] + chars

    return chars or "0"