Anonymous user
Module:IP/doc: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
add addFromString
(add overlapsSubnet) |
(add addFromString) |
||
Line 424:
collection:addSubnet('1.2.3.0/24')
collection:addSubnet(Subnet.new('1.2.3.0/24'))
</source>
=== addFromString ===
<source lang="lua">
collection:addFromString(str)
</source>
Extracts any IPv4 addresses and IPv4 CIDR subnets from <var>str</var> and adds them to the collection. Any text that is not an IPv4 address or CIDR subnet is ignored.
Examples:
<source lang="lua">
collection:addFromString('Add some IPs and subnets: 1.2.3.4 1.2.3.5 2001:0::f foo 1.2.4.0/24')
</source>
|