コード例 #1
0
def first_first(name):
    """
    Input: Name
    Output: First name appears first and last name appears last
    """
    parts = name_parser.split(name)
    return " ".join([p for p in parts if p])
コード例 #2
0
def last_first(name):
    """
    Input: Name
    Output: Last name appears first and first name appears last
    """
    pre, fp, lp, suf = name_parser.split(name)
    if lp:
        lp += ", "
    return lp + " ".join([p for p in [pre, fp, suf] if p])
コード例 #3
0
def last_initial(name):
    """
    Input: Name
    Output: Last Name in Abbrevated form
    """
    pre, fp, lp, suff = name_parser.split(name)

    if lp:
        lp = lp[0]
    return " ".join([p for p in [pre, fp, lp, suff] if p])
コード例 #4
0
def initial_initial(name):
    """
    Input: Name
    Output: First Name in Abbrevated form
    """
    pre, fp, lp, suff = name_parser.split(name)

    if fp:
        fp = fp[0]
    return " ".join([p for p in [pre, fp, lp, suff] if p])
コード例 #5
0
def last_only(name):
    """
    Input: Name
    Output: Last Name
    """
    return name_parser.split(name)[2]