I have a variable packet of type DatagramPacket
. While packet.getAddress().toString()
results in a String representing an the IP address, it has an extra /
appended to the beginning of the String:
/127.0.0.1
I can easily remove the leading '/'
, but is there a better way to just obtain a string representation of the IP? I am worried because what if there are more '/'
in other situations.
Thanks!