def to_int(s, default=None):
    """Attempts to convert the provided string to an integer.

    :param s: The text to convert
    :param default: Default value to return if cannot be converted
    :returns: The integer if converted, otherwise the default value
    """
    try:
        return int(s)
    except ValueError:
        pass

    return default