lanka-validations - v2.1.0
    Preparing search index...

    Function normalizePhoneNumber

    • Normalizes any Sri Lankan phone number string into a clean 10-digit national number (e.g., '0771234567').

      Parameters

      • raw: unknown

        Phone number in any common format.

      Returns string

      The national form with a leading 0 and no separators, or '' if the input contains other characters.

      normalizePhoneNumber('+94 77 123 4567'); // '0771234567'
      normalizePhoneNumber('(011) 234-5678'); // '0112345678'