Jump to content

uk postcode structure


Andy_1984

Recommended Posts

been looking around and cant find 100% confirmation if my thinking is correct

 

basically need to know if the last characters of a postcode are always 3 characters. for example G41 1BB and G1 1JE i need to grab the G1 or G41 part by removing the last 3 characters. if a postcode of say G41 1BTR ever poped up my programming (on a website) would be completely wrong by returning G411 <_<

Owner of Tacklesack.co.uk


Moderator at The-Pikers-Pit.co.uk

Link to comment
Share on other sites

Yep, 3 characters only for the second part of the postcode :)

John S

Quanti Canicula Ille In Fenestra

 

Species caught in 2017 Common Ash, Hawthorn, Hazel, Scots Pine, White Willow.

Species caught in 2016: Alder, Blackthorn, Common Ash, Crab Apple, Left Earlobe, Pedunculate Oak, Rock Whitebeam, Scots Pine, Smooth-leaved Elm, Swan, Wayfaring tree.

Species caught in 2015: Ash, Bird Cherry, Black-Headed Gull, Common Hazel, Common Whitebeam, Elder, Field Maple, Gorse, Puma, Sessile Oak, White Willow.

Species caught in 2014: Big Angry Man's Ear, Blackthorn, Common Ash, Common Whitebeam, Downy Birch, European Beech, European Holly, Hawthorn, Hazel, Scots Pine, Wych Elm.
Species caught in 2013: Beech, Elder, Hawthorn, Oak, Right Earlobe, Scots Pine.

Species caught in 2012: Ash, Aspen, Beech, Big Nasty Stinging Nettle, Birch, Copper Beech, Grey Willow, Holly, Hazel, Oak, Wasp Nest (that was a really bad day), White Poplar.
Species caught in 2011: Blackthorn, Crab Apple, Elder, Fir, Hawthorn, Horse Chestnut, Oak, Passing Dog, Rowan, Sycamore, Willow.
Species caught in 2010: Ash, Beech, Birch, Elder, Elm, Gorse, Mullberry, Oak, Poplar, Rowan, Sloe, Willow, Yew.

Link to comment
Share on other sites

been looking around and cant find 100% confirmation if my thinking is correct

 

basically need to know if the last characters of a postcode are always 3 characters. for example G41 1BB and G1 1JE i need to grab the G1 or G41 part by removing the last 3 characters. if a postcode of say G41 1BTR ever poped up my programming (on a website) would be completely wrong by returning G411 <_<

This should help you Andy.

http://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom

The problem isn't what people don't know, it's what they know that just ain't so.
Vaut mieux ne rien dire et passer pour un con que de parler et prouver que t'en est un!
Mi, ch’fais toudis à m’mote

Link to comment
Share on other sites

Wow!! What a convoluted system.

 

Andy it does look like your code needs to validity check up front and before processing

1. If postcode begins BFPO then (and a different set of rules) or

2. If postcode length > 7 and postcode does not begin BFPO then postcode = invalid (to allow for the space between the sections or the possibility that some bright bulb will put a - between them)

" My choices in life were either to be a piano player in a whore house or a politician. And to tell the truth, there's hardly any difference!" - Harry Truman, 33rd US President

Link to comment
Share on other sites

Wow!! What a convoluted system.
I's a very good system. UK Post codes are good enough to use as sat-nav co-ords, they are also used by automatic mail sorting machines to sort mail in sorting offices.
The Integrated Mail Processors - IMPs - that Royal Mail use, read the postcode on the item, and translates it into two phosphorous barcodes, unique to the inward and outward parts of the postcode, which the machines subsequently print and read, to sort the mail to the correct outward postcode. Letters may also be sequently sorted by a CSS machine, reading the outward postcode, in the order that a walking postman will deliver, door to door. The top phosphorous barcode is the inward part of the code, whilst the bottom is the outward, on such items.
Edited by corydoras

The problem isn't what people don't know, it's what they know that just ain't so.
Vaut mieux ne rien dire et passer pour un con que de parler et prouver que t'en est un!
Mi, ch’fais toudis à m’mote

Link to comment
Share on other sites

I's a very good system. UK Post codes are good enough to use as sat-nav co-ords, they are also used by automatic mail sorting machines to sort mail in sorting offices.

Didn't say it wasn't effective; just that it was complex and more than a bit convoluted.

" My choices in life were either to be a piano player in a whore house or a politician. And to tell the truth, there's hardly any difference!" - Harry Truman, 33rd US President

Link to comment
Share on other sites

Wow!! What a convoluted system.

 

Andy it does look like your code needs to validity check up front and before processing

1. If postcode begins BFPO then (and a different set of rules) or

2. If postcode length > 7 and postcode does not begin BFPO then postcode = invalid (to allow for the space between the sections or the possibility that some bright bulb will put a - between them)

 

 

got a regular expression checking theres no invalid characters in the postcode (a to z and 0 to 9 allowed only), in this script theres no need for the 3rd part of the postcode or the space so last 3 characters get ignore as does the space (if any)

 

that just leaves me with the first part of the customers postcode :D

 

its part of a delivery function for an online take away to only deliver within 3 miles of the shop and ive already got a list of the first part of the postcodes that are within 3 mile radius of the shop in an array and cross reference customer postcode with database postcodes. No match no delivery :D

Owner of Tacklesack.co.uk


Moderator at The-Pikers-Pit.co.uk

Link to comment
Share on other sites

Didn't say it wasn't effective; just that it was complex and more than a bit convoluted.
The Post Office like complex and convoluted, but it is a good system.

The problem isn't what people don't know, it's what they know that just ain't so.
Vaut mieux ne rien dire et passer pour un con que de parler et prouver que t'en est un!
Mi, ch’fais toudis à m’mote

Link to comment
Share on other sites

The postcodes for the Medway Towns were executed by a gentlman called Arthur Smith (my mother's best friend's husband). They're quite logical, but people took ages to get used to them.

This is a signature, there are many signatures like it but this one is mine

Link to comment
Share on other sites

Back in the day, most codes used in computer systems etc (eg invoice no, account no etc) had a check digit added so that the number could be verified for keying errors.

 

The systems dept I worked in decided not to make (then precious) space for storing a postcode as there was no way of verifying that a keying error had occurred. eg ME7 8AT keyed instead of ME8 7AT.

RNLI Shoreline Member

Member of the Angling Trust

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We and our partners use cookies on our website to give you the most relevant experience by remembering your preferences, repeat visits and to show you personalised advertisements. By clicking “I Agree”, you consent to the use of ALL the cookies. However, you may visit Cookie Settings to provide a controlled consent.