X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c4f22a42eba499ed1854c5967b2e3932fe9b3896..330b8d2fdfdd935da123abf9ecf96b3bc7a12be5:/lib-php/TokenPostcode.php diff --git a/lib-php/TokenPostcode.php b/lib-php/TokenPostcode.php index 94e17793..0ff92929 100644 --- a/lib-php/TokenPostcode.php +++ b/lib-php/TokenPostcode.php @@ -17,7 +17,7 @@ class Postcode { /// Database word id, if available. private $iId; - /// Full nomralized postcode (upper cased). + /// Full normalized postcode (upper cased). private $sPostcode; // Optional country code the postcode belongs to (currently unused). private $sCountryCode; @@ -25,7 +25,12 @@ class Postcode public function __construct($iId, $sPostcode, $sCountryCode = '') { $this->iId = $iId; - $this->sPostcode = $sPostcode; + $iSplitPos = strpos($sPostcode, '@'); + if ($iSplitPos === false) { + $this->sPostcode = $sPostcode; + } else { + $this->sPostcode = substr($sPostcode, 0, $iSplitPos); + } $this->sCountryCode = empty($sCountryCode) ? '' : $sCountryCode; }