ACF Library

ValidateAndCleanPhoneNumber

Back to List

Description: Clean phone numbers, ensure it is 8 digits.

FileMaker Prototype:

Set Variable [$res; ACF_Run("ValidateAndCleanPhoneNumber"; string_Phone)]

Category: CONTA API

Function source:

Function ValidateAndCleanPhoneNumber ( string Phone )
   // Norwegian phone numbers are exactly 8 digits.
   Phone = regex_replace("[^0-9]", Phone, ""); 
   if ( length (Phone) > 8) then
      Phone = right(Phone, 8); // Strip country code +47
   end if
   if ( length (Phone) < 8) then
      Phone = ""; // Invalid phone number
   end if
   return Phone; 
end

Back to List