FA-95914 / Postal address normalization / Member archive
Five-or-nine digit postal code: partial codes are truncated into valid ones · case 04
A seven-digit string is cut to its first five digits and accepted.
Case contract
Input a string or an integer. Integers are zero-padded to 5 digits when <= 99999, else to 9. Strings are stripped; a 10-character string with "-" or a space at index 5 loses that separator. Valid results are exactly 5 or 9 ASCII digits; 9 digits render "DDDDD-DDDD" unless the last four are "0000", which renders the 5-digit form. Anything else returns None.
Why this case matters
Postal codes arrive from spreadsheets, forms and legacy files; losing leading zeros or accepting malformed codes misroutes mail and breaks deduplication.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| seven digits rejected | "45069" | null | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗