Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blank space in UK postal code

Tags:

postal-code

Is there a way to know where the blank space has to be, in an UK postal code, if the user doesn't write the postal code with the blank space?

For example, if the input is: EC1A1BB, W1A0AX, M11AE, B338TH, CR26XH, DN551PT then the output must be: EC1A 1BB, W1A 0AX, M1 1AE, B33 8TH, CR2 6XH, DN55 1PT.

Thank you

like image 510
iusmar Avatar asked Oct 11 '17 15:10

iusmar


People also ask

Does UK postcode need a space?

Postcodes should always be in BLOCK CAPITALS as the last line of an address. Do not underline the postcode or use any punctuation. Leave a clear space of one character between the two parts of the postcode and do not join the characters in any way.

Where is the space in a UK postcode?

Each postcode consists of two parts. The first part is the outward postcode, or out- code. This is separated by a single space from the second part, which is the inward postcode, or in-code. The outward postcode enables mail to be sent to the correct local area for delivery.

How do I fill in a UK ZIP code?

UK postcodes consist of 5-7 alphanumeric characters, and are separated into two parts by a single space. The first part is the outward code, and it specifies an area and district of the UK. This is followed by a space and the inward code.

What is a UK postcode example?

Examples of postcodes are "SW1W 0NY", "PO16 7GZ", "GU16 7HF", and "L1 8JQ".


1 Answers

The space is always before the final three characters.

This graphic shows the format:

Format of a UK postcode

Source: GetTheData

like image 153
Dan Winchester Avatar answered Dec 06 '22 16:12

Dan Winchester