GitHubContribute in GitHub: Edit online


Converts the input string of IPv4 and netmask to long number representation (signed 64-bit).

parse_ipv4_mask("", 24) == 2130706432
parse_ipv4_mask('', 31) == parse_ipv4_mask('', 31)


parse_ipv4_mask(Expr, PrefixMask)


  • Expr: A string representation of the IPv4 address that will be converted to long.
  • PrefixMask: An integer from 0 to 32 representing the number of most-significant bits that are taken into account.


If conversion is successful, the result will be a long number. If conversion isn't successful, the result will be null.