Extract code country from phone number [libphonenumber]

前端 未结 7 1779
情深已故
情深已故 2020-11-27 13:21

I have a string like this : +33123456789 (french phone number). I want to extract the country code (+33) without knowing the country. For example, it should work if i have a

相关标签:
7条回答
  • 2020-11-27 14:02

    Use a try catch block like below:

    try { 
    
    const phoneNumber = this.phoneUtil.parseAndKeepRawInput(value, this.countryCode);
    
    }catch(e){}
    
    0 讨论(0)
提交回复
热议问题