from typing import Union
from typing import List


def list_of_ints(string: str, delimiter: Union[str, None] = None) -> List[int]:
    """Cast a string to a list of integers.

    Args:
        string: String to be converted to a list of int's.
        delimiter: Delimiter between integers in the string.
            Default is to split with any whitespace string (see str.split() method).
    """
    return [int(sp) for sp in string.split(sep=delimiter)]