-rw-r--r-- | kabc/phonenumber.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index d7e3925..3d82553 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp @@ -88,4 +88,26 @@ void PhoneNumber::simplifyType() else mType = Pref; } +bool PhoneNumber::contains( const PhoneNumber &p ) +{ + QString Number; + QString Num; + uint i; + Number = mNumber.stripWhiteSpace (); + Num = ""; + for ( i = 0; i < Number.length(); ++i) { + if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) + Num += Number.at(i); + } + QString NumberR; + QString NumR; + NumberR = p.mNumber.stripWhiteSpace (); + NumR = ""; + for ( i = 0; i < NumberR.length(); ++i) { + if ( NumberR.at(i).isDigit() || NumberR.at(i) == '+'|| NumberR.at(i) == '*'|| NumberR.at(i) == '#' ) + NumR += NumberR.at(i); + } + return (Num == NumR); +} + void PhoneNumber::setId( const QString &id ) { |