public static boolean isZipCode ( String s ) { if ( isEmpty ( s ) ) return defaultEmptyOK ; String normalizedZip = stripCharsInBag ( s , ZipCodeDelimiters ) ; return ( isInteger ( normalizedZip ) && ( ( normalizedZip . length ( ) == digitsInZipCode1 ) || ( normalizedZip . length ( ) == digitsInZipCode2 ) ) ) ; }
isZIPCode returns true if string s is a valid U . S . ZIP code . Must be 5 or 9 digits only .