#check if Ipv6 is present in the subnet
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
Hi there
I think In java there is a built-in API called InetAddress.getByName()
That can help you in this
I want to validate if the Ipv6 address is present in the prefix
string.contains(":");
But realistically, check java.net.Inet6Address
When using InetAddress.getByName if it's IPV6 it'll return a Inet6Address if it's IPV6
i.e.
boolean isIpv6(String addr) {
return InetAddress.getByName(addr) instanceof Inet6Address;
}```
Or something similar
I want to determine if the IP address "21ab:1212:43:d45::" is present in "21ab:1212:43::\48"
if(str.contains(str2) ?
no
why