mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 11:06:50 +01:00
implement startsWith and endsWith.
This commit is contained in:
@@ -623,6 +623,22 @@ S cat(const S& delim, const It& begin, const It& end)
|
||||
}
|
||||
|
||||
|
||||
template <class S>
|
||||
bool startsWith(const S& str, const S& prefix)
|
||||
/// Tests whether the string starts with the given prefix.
|
||||
{
|
||||
return equal(prefix.begin(), prefix.end(), str.begin());
|
||||
}
|
||||
|
||||
|
||||
template <class S>
|
||||
bool endsWith(const S& str, const S& suffix)
|
||||
/// Tests whether the string ends with the given suffix.
|
||||
{
|
||||
return equal(suffix.rbegin(), suffix.rend(), str.rbegin());
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// case-insensitive string equality
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user