def str2numorstr(x, method=int):
    """
    This extracts numbers from strings. eg. 114 from M114R.

    :param x: string
    """
    try:
        x = method(x)
        return x
    except:
        return x
