Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8.2, 0.8.3, and 0.9

stable shellext: new function StartsWith

Changeset 29a854c1bd61

Parent a950c6087769

by Adrian Buehlmann

Changes to 2 files · Browse files at 29a854c1bd61 Showing diff from parent a950c6087769 Diff from another changeset...

 
300
301
302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
@@ -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
25
26
 
27
28
 
24
25
26
27
28
29
@@ -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