0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gitwatch > endsWith(s, ".wav") > ".wav"で終わるかどうか

Last updated at Posted at 2015-07-15

/// 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メソッドがあるようだ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?