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
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.
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.
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.
Examples of postcodes are "SW1W 0NY", "PO16 7GZ", "GU16 7HF", and "L1 8JQ".
The space is always before the final three characters.
This graphic shows the format:
Source: GetTheData
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With