Name Format Strings

A quick guide to name format strings and how to use them.

  • Formatting adds appropriate spaces, removes empty values, extraneous punctuation and the like.
  • Formatting for organizations ignores the format codes and returns the last (company) name.

Available Format Codes:

 P : prefix
 F : first name
 L : last name
 N : preferred name (preferred if exists, otherwise first name)
 K : preferred name if different from first, otherwise blank
 M : middle name
 I : middle initial
 S : suffix
 . : literal '.' character
 , : literal ',' character
 ( : literal '(' character
 ) : literal ')' character

 Default format string: F(K)I.L

Examples

Sample name data:
{
    'prefix': 'Ms',
    'first': 'First',
    'preferred': 'Bob',
    'middle': 'Middle',
    'last': 'Last',
    'suffix': 'III'
}
'F' -> 'First'
'N' -> 'Bob'
'K' -> 'Bob'
'P.NI.L,S' -> 'Ms. Bob M. Last, III'
'P.NI.L,S' -> 'Last' (if person was organization)
'P.F(k)I.(m)L,s' -> 'Ms. First (Bob) M. (Middle) Last, III'
Sample name data:
{
    'first': 'First',
    'preferred': 'First',
    'last': 'Last'
}
'F' -> 'First'
'N' -> 'First'
'K' -> ''
'P.NI.L,S' -> 'First Last'
'P.NI.L,S' -> 'Last' (if person was organization)
'P.F(k)I.(m)L,s' -> 'First Last'

Address Format Strings

A quick guide to address format strings and how to use them.

  • Formatting adds appropriate spaces, removes empty values, extraneous punctuation and the like.

Available Format Codes:

 O : Organization
 1 : Line 1
 2 : Line 2
 C : City
 R : Region
 E : Zip Code with zip+4 extension (Domestic)
 F : Foreign Code (International)
 N : Country
 I : International Country (blank if United States)
 Z : Zip Code without zip+4 extension (Domestic)
 B : Delivery Point Barcode
 , : A literal ',' character
 ^ : New-line token (replaced by standard line ending)

Default format string: O^1^2^C,REF^I

Examples

Sample domestic address data:
{
    'line1': '284 Lincoln St',
    'line2': '',
    'organization': 'NOLS',
    'city': 'Lander',
    'region': 'WY',
    'country': 'United States',
    'zipcode': '82520',
    'zipcode_ext': '3140'
}
'O^1^2^C,REF^N' -> 'NOLS\n284 Lincoln St\nLander, WY 82520-3140\nUnited States'
'O^1^2^C,REF^I' -> 'NOLS\n284 Lincoln St\nLander, WY 82520-3140'
'1^2^C,RE' -> '284 Lincoln St\nLander, WY 82520-3140'
Sample international address data:
{
    'line1': 'Casilla  25-D',
    'line2': 'Correos de Chile',
    'organization': 'NOLS Patagonia',
    'city': 'Coyhaique',
    'region': '',
    'country': 'Chile',
    'foreign_code': 'REGION XI',
}
'O^1^2^C,REF^N' -> 'NOLS Patagonia\nCasilla 25-D\nCorreos de Chile\nCoyhaique, REGION XI\nChile'
'O^1^2^C,REF^I' -> 'NOLS Patagonia\nCasilla 25-D\nCorreos de Chile\nCoyhaique, REGION XI\nChile'