The original method of extracting the IP address from an IP:PORT pair never re-applied the PORT number to the sorting algorithm.
This commit has added the functionality for the port number to be included in the sorting for IPv4 if it existed in the original value by appending it to the final zero-filled IPv4 address string.
This commit also reduces the number of if/else chains to perform the zerofill by using a substr of a zeroed pattern matching the desired size of the field. "000" for IPv4 octets, "0000" for IPv6, and "00000" for port numbers.