ok its been a hard week, this ones easy but i just cant think properly
i have a database of postcodes
WV11 3QS
AB12 8EB
W1 7YY
I want to echo the first part of the character, so for the above examples
WV
AB
W
extracting part of postcode
Moderator: General Moderators
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: extracting part of postcode
You can do it various ways.
Just off the top of my head.
Explode on the white space then take the first part of the array and go through it character at a time and keep appending the result until a number is reached.
You could use a regular expression, if you wanted to be fancy.
Just off the top of my head.
Explode on the white space then take the first part of the array and go through it character at a time and keep appending the result until a number is reached.
You could use a regular expression, if you wanted to be fancy.