parse_ipv4_mask()parse_ipv4_mask()

将 IPv4 和网络掩码的输入字符串转换为长数字表示形式(带符号的 64 位)。Converts the input string of IPv4 and netmask to long number representation (signed 64-bit).

parse_ipv4_mask("127.0.0.1", 24) == 2130706432
parse_ipv4_mask('192.1.168.2', 31) == parse_ipv4_mask('192.1.168.3', 31)

语法Syntax

parse_ipv4_mask(Expr, PrefixMask)

参数Arguments

  • Expr :将转换为 long 类型的 IPv4 地址的字符串表示形式。Expr: A string representation of the IPv4 address that will be converted to long.
  • PrefixMask :从 0 到 32 的整数,表示所考虑的最有效位的数目。PrefixMask: An integer from 0 to 32 representing the number of most-significant bits that are taken into account.

返回Returns

如果转换成功,则结果将是一个 long 类型的数字。If conversion is successful, the result will be a long number. 如果转换未成功,结果将为 nullIf conversion isn't successful, the result will be null.