formatUSZipCode

String sutil.formatUSZipCode ( String zip ) (professional and enterprise editions only)

Description

Formats and returns a US style zip code as 12345-6789. If the given zip code isn't 5 or 9 digits, will log a warning, but it will put 5 digits before the - and anything else (if any) after the -

Parameters

  • zip String to format as a zip code, either 5 or 9 digits

Return Values

Zip code formatted String, such as 12345-6789 or 12345

Change Log

Version Description
5.5.26a Available in all editions.

Examples

 // Format a number to a nicer looking zip code
 String zip = sutil.formatUSZipCode(" 001011458");
 
 // zip would be "00101-1458"