def str_to_int(i):
    """
    Converts a string into integer. Returns 0 if a string cannot be
    converted.

    Args:
        i (str): string representation of an integer

    Returns:
        int: conversion of the string
    """
    try:
        return int(i)
    except ValueError:
        return 0