FA-95897 / Postal address normalization / Member archive
Five-or-nine digit postal code: integer codes are not zero-padded · case 02
A code stored as the integer 1231 is rejected instead of normalizing to "01231".
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 |
|---|---|---|---|
| spreadsheet integer lost its leading zero | null | "01232" | 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 ↗