Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PhoneNumber::PhoneNumber(const string& international_number) {
- int i = 1;
- if (international_number[0] != '+')
- throw invalid_argument("dsfa");
- SplitForCountryCode(i, international_number);
- SplitForCityCode(i, international_number);
- //cout << country_code_ << city_code_;
- }
- void PhoneNumber::SplitForCountryCode(int& i, const string& international_number) {
- /*country_code_ = "+";*/
- for (i; i <= international_number.length() && international_number[i] != '-'; ++i) {
- country_code_ += international_number[i];
- }
- country_code_.erase(std::remove_if(country_code_.begin(), country_code_.end(), ::isspace), country_code_.end());
- if ("+" + country_code_ == international_number || i == 1)
- throw invalid_argument("dsfa");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement