Remove formatting from a string: “(123) 456-7890” => “1234567890”?

后端 未结 14 778
一整个雨季
一整个雨季 2021-02-05 01:12

I have a string when a telephone number is inputted - there is a mask so it always looks like \"(123) 456-7890\" - I\'d like to take the formatting out before saving it to the D

14条回答
  •  再見小時候
    2021-02-05 01:28

    You can make it work for that number with the addition of a simple regex replacement, but I'd look out for higher initial digits. For example, (876) 543-2019 will overflow an integer variable.

提交回复
热议问题