Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 847 Bytes

addrinsubnet.adoc

File metadata and controls

35 lines (27 loc) · 847 Bytes

AddrInSubnet()

Important

Deprecated in 5.0.

Please use sameSubnet() method of InetAddress class.

AddrInSubnet(address, subnet, mask) ⇒ Boolean

Checks if given IP address is within given subnet (including subnet and broadcast addresses). IPv4 and IPv6 are supported.

Table 1. Parameters

address

String

IP address to check.

subnet

String

Subnet address.

mask

String

Subnet mask, either decimal dotted notation or CIDR notation.

Return

TRUE if address is within given subnet (including subnet and broadcast addresses), and FALSE otherwise.

Example
AddrInSubnet("10.0.0.16", "10.0.0.0", "24")		//TRUE
AddrInSubnet("10.0.0.16", "192.168.1.0", "255.255.255.0")	//FALSE