Convert string to integers/booleans where it should be
423594
function optionsFromStrings(options) {
	var intOptions = ["width", "height", "textMargin", "fontSize", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight"];

	for (var intOption in intOptions) {
		if (intOptions.hasOwnProperty(intOption)) {
			intOption = intOptions[intOption];
			if (typeof options[intOption] === "string") {
				options[intOption] = parseInt(options[intOption], 10);
			}
		}
	}

	if (typeof options["displayValue"] === "string") {
		options["displayValue"] = options["displayValue"] != "false";
	}

	return options;
}
545363
@Override
  public Boolean decode(final String s) {
    checkNotNull(s);
    if ("true".equals(s)) {
      return Boolean.TRUE;
    } else if ("false".equals(s)) {
      return Boolean.FALSE;
    } else {
      throw new ConversionException(
          String.format("Strictly-converted booleans must be either 'true' or 'false', not %s", s));
    }
  }
914946
def _parse_bool(value):
    """"""
    if isinstance(value, bool):
        return value

    elif isinstance(value, str):
        if value == 'True':
            return True
        elif value == 'False':
            return False

    raise Exception("Value %s is not boolean." % value)
650123
function (value) {
    value += '';

    if (value.search(/^\-?\d+$/) > -1) {
      return 'integer';
    }

    if (value.search(/^\-?\d+\.\d+[\d.]*$/) > -1) {
      return 'float';
    }

    if ('false' === value || 'true' === value) {
      return 'boolean';
    }

    if (value.search(/^\d{4}\-\d{2}\-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z?$/) > -1) {
      return 'datetime';
    }

    return 'string';
  }
1323121
def convert_boolean(value, parameter, default=False):
    '''
    
    '''
    value = _check_default(value, parameter, ( '', '-', None ))
    if isinstance(value, bool):
        return value
    if isinstance(value, str) and len(value) > 0:
        value = value[0]
    return value not in ( 'f', 'F', '0', False, None )
538975
def str_to_boolean(input_str):
    
    if not isinstance(input_str, six.string_types):
        raise ValueError(input_str)
    input_str = str_quote_stripper(input_str)
    return input_str.lower() in ("true", "t", "1", "y", "yes")
1327979
def boolean(value):
    
    if isinstance(value, bool):
        return value

    if value == "":
        return False

    return strtobool(value)
772991
private Integer checkString(final String value)
	{
		Integer val = 50;
		if (value != null && !value.isEmpty())
		{
			if (value.endsWith("%"))
			{
				final String sVal = value.substring(0, value.length() - 1);
				if (StringUtils.isNumeric(sVal))
				{
					val = Integer.valueOf(sVal);
				}
			}
			else
			{
				if (StringUtils.isNumeric(value))
				{
					val = Integer.valueOf(value);
				}

			}
		}
		return val;
	}
435942
function( str ) {
        // if whole numbers, convert to integer
        if( /^\d+$/.test(str) ) return parseInt( str );
        // if decimal, convert to float
        if( /^\d*\.\d+$/.test(str) ) return parseFloat( str );
        // if "true" or "false", return boolean
        if( /^true$/.test(str) ) return true;
        if( /^false$/.test(str) ) return false;
        // else, return original string
        return str;
    }
1036910
public static int stringToInteger(String string) {
        string = string.trim();
        if (Checker.isNumber(string)) {
            return Integer.parseInt(string);
        }
        return -1;
    }
810701
def to_bool(value):
    
    cases = {
        '0': False,
        'false': False,
        'no': False,

        '1': True,
        'true': True,
        'yes': True,
    }
    value = value.lower() if isinstance(value, basestring) else value
    return cases.get(value, bool(value))
550051
def setting_str_to_bool(s):
    
    if isinstance(s, six.string_types):
        s = s.lower()
        if s == 'true':
            return True
        elif s == 'false':
            return False
        else:
            return ValueError('Invalid boolean representation: {!r}'.format(s))
    else:
        return s
1070932
def string_to_int(string, alphabet):
    
    number = 0
    alpha_len = len(alphabet)
    for char in string:
        number = number * alpha_len + alphabet.index(char)
    return number
1198952
def to_bool(val):
    '''
    
    '''
    if val is None:
        return False
    if isinstance(val, bool):
        return val
    if isinstance(val, (six.text_type, six.string_types)):
        return val.lower() in ('yes', '1', 'true')
    if isinstance(val, six.integer_types):
        return val > 0
    if not isinstance(val, collections.Hashable):
        return bool(val)
    return False
1306962
public static int toInt(String string, int from) {
        int val = 0;
        boolean started = false;
        boolean minus = false;

        for (int i = from; i < string.length(); i++) {
            char b = string.charAt(i);
            if (b <= ' ') {
                if (started)
                    break;
            } else if (b >= '0' && b <= '9') {
                val = val * 10 + (b - '0');
                started = true;
            } else if (b == '-' && !started) {
                minus = true;
            } else
                break;
        }

        if (started)
            return minus ? (-val) : val;
        throw new NumberFormatException(string);
    }
883878
private static String intPart(String str) {
        return str.indexOf(JAVA_DECIMAL_POINT) > 0 ? str.substring(0,
                str.indexOf(JAVA_DECIMAL_POINT)) : str;
    }
1038988
def _str_to_bool(str_):
    """"""
    if str_.lower() not in ['true', 'false', 'none']:
        raise ValueError('Need bool; got %r' % str_)
    return {'true': True, 'false': False, 'none': None}[str_.lower()]