QUrl url = QUrl::fromUserInput("example.com"); QUrl adjustedUrl = QUrl::adjusted(url, QUrl::NormalizePathSegments); qDebug() << adjustedUrl.toString(); // prints "http://example.com/"
QUrl url = QUrl::fromUserInput("https://example.com/path/"); QUrl adjustedUrl = QUrl::adjusted(url, QUrl::RemoveTrailingSlash); qDebug() << adjustedUrl.toString(); // prints "https://example.com/path"
QUrl url = QUrl::fromUserInput("hTtPs://example.com"); QUrl adjustedUrl = QUrl::adjusted(url, QUrl::FullyDecoded); qDebug() << adjustedUrl.scheme(); // prints "https"QUrlAdjusted is part of the Qt Network module.