the string on ":" and parse
the second part? Use a regex
to validate and separate the parts? Use StringReader
, with the delimiter
set to ":"?
There are a lot of ways of doing it. Hopefully the API links will help you string it all together.
Also, for the record: most command-line tools I've used that take a hostname and port will take them as separate arguments (see: telnet, netcat) or a command-line switch (see: ssh)... most don't use the "hostname:port" syntax. But if that's what your assignment says to do then I guess it's what your assignment says to do...