Formatting phone no to E.164

I am working with Twilio API and need to pass to API phone numbers formatted to E.164 format which is for Australia eg. +61471676100 now user will provide their number usually in format 0471 676 100 which has leading 0 which needs to be striped off and spaces in between numbers which need to be removed.

I guess I can easily trim and then test if 1st character is 0 and if so then stripe and add the +61 but what is the best way to strip out the spaces if exists?

I notice there are several plugins that may help in this area but my data is loaded via csv so any workflow would need to be server side

This topic was automatically closed after 70 days. New replies are no longer allowed.