Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/shared/Utils.cpp

Issue 5921969115496448: Issue 1115 - Some yahoo page not correctly shown on IE8 when ABP enabled (Closed)
Patch Set: fix and rebase Created March 4, 2015, 1:21 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/shared/Utils.h ('k') | test/UtilGetQueryStringTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « src/shared/Utils.h ('k') | test/UtilGetQueryStringTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld