Support conversion of linkshere
[dueringa_WikiWalker.git] / src / StringUtils.cpp
blob7530ef805d91d88aa065806436d59dd1d53b2eb5
1 //! \file StringUtils.cpp
3 #include "StringUtils.h"
5 namespace WikiWalker
7 bool StringUtils::startsWith(const std::string& stringToTest,
8 const std::string& beginning)
10 if(stringToTest.empty() || beginning.empty()) {
11 return false;
14 // can't be starting with beginning if it's shorter
15 if(stringToTest.length() < beginning.length()) {
16 return false;
19 // suffice to compare n characters, where n is length of beginning
20 return stringToTest.substr(0, beginning.length()) == beginning;
22 } // namespace WikiWalker