Version 0 of Postcodes

Updated 2004-10-25 13:36:37 by suchenwi

Richard Suchenwirth 2004-10-25 - Convert Canadian postcodes (only the first three characters) to USPS ZIP+4 codes:

 proc ca2us {postcode} {
   set map {0 1 2 3 4 5 6 7 8 9 - 
      A B C D E F G H I - J K L M N O P Q R - S T U V W X Y Z}
   set res 00101-
   foreach {a b c} [split [string toup $postcode] ""] break
   foreach i {a b c} {
        append res [format %02d [lsearch $map [set $i]]]
   }
   set res
 }
 % ca2us M3H
 00101-240318

Arts and crafts of Tcl-Tk programming