I am currently writing a network application in Qt and need to seperate network adresses in the form:
example.org:1234
into seperate hostname and port QStrings.
Is there a Qt function to easily parse this and check if the given input is correct?
Thanks in advance!
This is quite simple; you just use the
QUrlclass for this with the constructor, host() and port() methods as follows:As for your comment for avoiding the scheme usage in each url, you could use this:
or