Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
strstr または string find() を使用する必要がある理由を誰か説明してもらえますか? どこで、どちらが速いですか?
C++ では std::string::find() を使用し、C では strstr() を使用する必要があります。パフォーマンスの違いは重要ではありません。
どちらが速いかは問題ではありません。さらに重要なのは、 std::string::find が安全であることです。したがって、c++ を使用する場合は、std::string クラスを使用し、古い c 関数を使用しないでください。