mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
Add tools: StrStartsWith, StrEndsWith
This commit is contained in:
parent
3ee5d32e88
commit
0f3f60e815
|
@ -39,6 +39,24 @@ inline auto ToStrVector(const int argc, char*const* argv, const bool dropProgram
|
|||
}
|
||||
}
|
||||
|
||||
inline bool StrStartsWith(std::string const& str, std::string const& start)
|
||||
{
|
||||
if (str.length() >= start.length()) {
|
||||
return (0 == str.compare(0, start.length(), start));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool StrEndsWith(std::string const& str, std::string const& end)
|
||||
{
|
||||
if (str.length() >= end.length()) {
|
||||
return (0 == str.compare(str.length() - end.length(), end.length(), end));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace fair::mq::tools
|
||||
|
||||
#endif /* FAIR_MQ_TOOLS_STRINGS_H */
|
||||
|
|
Loading…
Reference in New Issue
Block a user