seancfoley / IPAddress

Java library for handling IP addresses and subnets, both IPv4 and IPv6
https://seancfoley.github.io/IPAddress/
Apache License 2.0
469 stars 63 forks source link

Is there a way to get address string (without length) from IPAddress? #98

Closed simPod closed 1 year ago

simPod commented 1 year ago

new IPAddressString("0.0.0.0/0").getAddress()

How can I get 0.0.0.0 from IPAddress?

seancfoley commented 1 year ago

Use getHostAddress or toHostAddress

seancfoley commented 1 year ago

Other options are to use toZeroHost or getLower on the result from getAddress, and then on that result call withoutPrefixLength