It doesn’t work when there’s no ‘/’ or ‘:’ after the domain name (returns empty string).
String URL::getDomain() const
{
const int start = URLHelpers::findStartOfNetLocation (url);
const int end1 = url.indexOfChar (start, '/');
const int end2 = url.indexOfChar (start, ':');
const int end = (end1 < 0 || end2 < 0) ? jmax (end1, end2)
: jmin (end1, end2);
return url.substring (start, end);
}
You need to check that if both end1 and end2 = -1 then return the whole string.
