If you dig around, you might find some sort of AJAX control for IP addresses, but there's nothing wrong with your idea. You can use a 4-element array to hold the 4 parts of the IPV4 address. The
String split() method can help you break the address parts out from a string.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.