from typing import Union


def isfloat(val: Union[int, float, str]):
    """
    Checks if the contents of a string is a float.
    :param val: String to parse
    :return:    bool
    """
    try:
        if isinstance(val, str):
            val.strip()
        float(val)
        return True
    except ValueError:
        return False