Index: src/shared/Utils.cpp |
diff --git a/src/shared/Utils.cpp b/src/shared/Utils.cpp |
index 7a14db81c33c4b8a426344f45549afc4b902df1f..d6f004c524c9bbcd59a7bc77368d0f0f979435cf 100644 |
--- a/src/shared/Utils.cpp |
+++ b/src/shared/Utils.cpp |
@@ -155,3 +155,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); |
+} |