Changeset 29a854c1bd61…
Parent a950c6087769…
by
Changes to 2 files · Browse files at 29a854c1bd61 Showing diff from parent a950c6087769 Diff from another changeset...
@@ -300,3 +300,21 @@ return 0;
}
+// true if a starts with b
+bool StartsWith(const std::string& a, const std::string& b)
+{
+ if (a.empty() || b.empty())
+ return false;
+
+ if (b.size() > a.size())
+ return false;
+
+ for (std::string::size_type i = 0; i < b.size(); ++i)
+ {
+ if (a[i] != b[i])
+ return false;
+ }
+
+ return true;
+}
+
|
@@ -24,5 +24,6 @@ int GetRegistryConfig(const std::string& name, std::string& res);
FILE* fopenReadRenameAllowed(const char* path);
int GetRegSZValue(HKEY hkey, const char* name, std::string& res);
+bool StartsWith(const std::string& a, const std::string& b);
#endif
|
Loading...