Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. PhoneNumber::PhoneNumber(const string& international_number) {
  2. int i = 1;
  3. if (international_number[0] != '+')
  4. throw invalid_argument("dsfa");
  5.  
  6. SplitForCountryCode(i, international_number);
  7. SplitForCityCode(i, international_number);
  8. //cout << country_code_ << city_code_;
  9. }
  10.  
  11. void PhoneNumber::SplitForCountryCode(int& i, const string& international_number) {
  12. /*country_code_ = "+";*/
  13. for (i; i <= international_number.length() && international_number[i] != '-'; ++i) {
  14. country_code_ += international_number[i];
  15. }
  16. country_code_.erase(std::remove_if(country_code_.begin(), country_code_.end(), ::isspace), country_code_.end());
  17. if ("+" + country_code_ == international_number || i == 1)
  18. throw invalid_argument("dsfa");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement