mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3841 Add compare to RiaStdStringTools
This commit is contained in:
parent
d6e40f25ff
commit
560549a5cb
@ -102,6 +102,17 @@ bool RiaStdStringTools::startsWithAlphabetic(const std::string& s)
|
||||
return isalpha(s[0]) != 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaStdStringTools::endsWith(const std::string& mainStr, const std::string& toMatch)
|
||||
{
|
||||
if (mainStr.size() >= toMatch.size() && mainStr.compare(mainStr.size() - toMatch.size(), toMatch.size(), toMatch) == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -127,3 +138,4 @@ size_t RiaStdStringTools::findCharMatchCount(const std::string& s, char c)
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,9 @@ public:
|
||||
static bool containsAlphabetic(const std::string& s);
|
||||
static bool startsWithAlphabetic(const std::string& s);
|
||||
|
||||
static bool endsWith(const std::string& mainStr, const std::string& toMatch);
|
||||
|
||||
|
||||
static std::vector<std::string> splitStringBySpace(const std::string& s);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user