stdnum.us.ssn

SSN (U.S. Social Security Number).

The Social Security Number is used to identify individuals for taxation purposes.

>>> is_valid('111-22-3333')
True
>>> is_valid('1112-23333')
False
>>> is_valid('666-00-0000')
False
>>> compact('1234-56-789')
'123456789'
>>> format('111223333')
'111-22-3333'
stdnum.us.ssn.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.us.ssn.format(number)

Reformat the passed number to the standard format.

stdnum.us.ssn.is_valid(number)

Checks to see if the number provided is a valid SSN. This checks the length, groups and formatting if it is present.

Previous topic

stdnum.sk.rc