mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
Accept also numbers in airport ICAO codes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#include "blackmisc/aviation/airporticaocode.h"
|
#include "blackmisc/aviation/airporticaocode.h"
|
||||||
#include "blackmisc/compare.h"
|
#include "blackmisc/compare.h"
|
||||||
|
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
@@ -31,8 +31,9 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
QString code = icaoCode.trimmed().toUpper();
|
QString code = icaoCode.trimmed().toUpper();
|
||||||
if (code.length() != 4) return "";
|
if (code.length() != 4) return "";
|
||||||
QRegExp reg("[A-Z]{4}");
|
QRegularExpression reg("^[A-Z0-9]{4}$");
|
||||||
return (reg.exactMatch(code)) ? code : "";
|
auto match = reg.match(code);
|
||||||
|
return match.hasMatch() ? code : QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAirportIcaoCode::isValidIcaoDesignator(const QString &icaoCode)
|
bool CAirportIcaoCode::isValidIcaoDesignator(const QString &icaoCode)
|
||||||
|
|||||||
Reference in New Issue
Block a user