MCPcopy Create free account
hub / github.com/catboost/catboost / GetParentDomain

Function GetParentDomain

library/cpp/string_utils/url/url.cpp:319–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319TStringBuf GetParentDomain(const TStringBuf host Y_LIFETIME_BOUND, size_t level) noexcept {
320 size_t pos = host.size();
321 for (size_t i = 0; i < level; ++i) {
322 pos = host.rfind('.', pos);
323 if (pos == TString::npos)
324 return host;
325 }
326 return host.SubStr(pos + 1);
327}
328
329TStringBuf GetZone(const TStringBuf host Y_LIFETIME_BOUND) noexcept {
330 return GetParentDomain(host, 1);

Callers 2

GetZoneFunction · 0.85
Y_UNIT_TESTFunction · 0.85

Calls 3

sizeMethod · 0.45
rfindMethod · 0.45
SubStrMethod · 0.45

Tested by

no test coverage detected