Created
February 12, 2013 01:09
-
-
Save cablehead/4759159 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int main() { | |
| int valid = 0; | |
| int invalid = 0; | |
| string line; | |
| string formatted; | |
| PhoneNumberUtil* util = PhoneNumberUtil::GetInstance(); | |
| PhoneNumber number; | |
| while (cin) { | |
| getline(cin, line); | |
| if (cin.eof()) break; | |
| if (util->Parse(line, "US", &number) != PhoneNumberUtil::NO_PARSING_ERROR) { | |
| invalid += 1; | |
| continue; | |
| } | |
| if (util->IsValidNumber(number)) { | |
| valid += 1; | |
| cout << line << endl; | |
| } else { | |
| invalid += 1; | |
| } | |
| // util->Format(number, PhoneNumberUtil::INTERNATIONAL, &formatted); | |
| // cout << formatted<< endl; | |
| } | |
| cout << endl; | |
| cout << "Valid: " << valid << endl; | |
| cout << "Invalid: " << invalid << endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment