/// Checks if the given string ends with the given substring
bool endsWith( string const & str, string const & tail )
{
return str.size() >= tail.size() &&
str.compare( str.size() - tail.size(), tail.size(), tail ) == 0;
}
自分でこういう関数を作った時、isTerminatingWith...など長い名前にしてしまっていたが、EndsWithはシンプルでいいと思う。
https://msdn.microsoft.com/ja-jp/library/2333wewz(v=vs.110).aspx
.NET Frameworkでも .EndsWithメソッドがあるようだ。