KScript docs
EN

cidr fields and methods

A field is a plain fact about the value, read with a dot and no brackets: $value.name. A method takes arguments or does work, and is called with ->: $value->name(arguments), or with the value piped in: $value |> name(arguments).

Fields

FieldTypeDescription
.lastipThe last address of the block: 10.255.255.255 for 10.0.0.0/8.
.networkipThe first address of the block.
.prefixnumberThe prefix length: 8 for 10.0.0.0/8.
.sizenumberHow many addresses the block holds: 256 for a /24.

From KScript.Core

#cidr->contains(address: ip) → bool

True when the address is in the block.
ParameterTakes
address requiredip
Example
<let name="x" type="cidr" value="'10.0.0.0/8'" />
<echo>{ $x->contains('10.20.30.40') }</echo>
$x: cidr = '10.0.0.0/8'
echo $x->contains('10.20.30.40')

Methods from any

Methods from string