Index: src/shared/Utils.cpp |
diff --git a/src/shared/Utils.cpp b/src/shared/Utils.cpp |
index 52b5a69f7920a6b9a49a46e16b250e2accaa33f8..5314709a6aa49d69b4ceb3ce2f24b4078f42accf 100644 |
--- a/src/shared/Utils.cpp |
+++ b/src/shared/Utils.cpp |
@@ -147,3 +147,29 @@ void ReplaceString(std::wstring& input, const std::wstring placeholder, const st |
input.replace(replaceStart, placeholder.length(), replacement); |
} |
} |
+ |
+std::wstring GetSchemeAndHierarchicalPart(const std::wstring& url) |
+{ |
+ auto schemeAndHierarchicalPartEndsAt = url.find(L'?'); |
+ if (schemeAndHierarchicalPartEndsAt == std::wstring::npos) |
+ { |
+ schemeAndHierarchicalPartEndsAt = url.find(L'#'); |
+ } |
+ return url.substr(0, schemeAndHierarchicalPartEndsAt); |
+} |
+ |
+std::wstring GetQueryString(const std::wstring& url) |
+{ |
+ auto questionSignPos = url.find(L'?'); |
+ if (questionSignPos == std::wstring::npos) |
+ { |
+ return L""; |
+ } |
+ auto queryStringBeginsAt = questionSignPos + 1; |
+ auto endQueryStringPos = url.find(L'#', queryStringBeginsAt); |
+ if (endQueryStringPos == std::wstring::npos) |
+ { |
+ endQueryStringPos = url.length(); |
+ } |
+ return url.substr(queryStringBeginsAt, endQueryStringPos - queryStringBeginsAt); |
+} |