Netip.octet.lead: def of bend-kit-netip@0.1.0.0 Import: import bend-kit-netip@0.1.0.0/netip.bend as Netip Lines 55-61 of bend-kit-netip@0.1.0.0/netip.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-netip@0.1.0.0/netip.bend&start_line=55&end_line=61 import Base # 1 to 3 characters, and no leading zero unless the octet is "0". def octet.lead(s: String) -> Bool: match s: case SNil{}: False{} case SCon{Chr{c}, +t}: Bool.and(Nat.is_le(String.length(t), 2n), Bool.or(Bool.not(U32.is_eq(c, 48)), String.is_empty(t))) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Char https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.is_empty https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.length https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq