def str_to_integer(string, default):
    """
    Returns string formatted to integer
    @param: string - String to format
    @param: default - Default integer wanted if string isn't possible to format.
    """
    try:
        return int(string)
    except ValueError:
        return default