Can someone please explain why I should use strstr or string find() ? Which one is faster, at where ?
In C++ you should use std::string::find(), in C you should use strstr(). The difference in performance should not be significant.
It doesn't matter which is faster. Much more important is that the std::string::find is safe. So use std::string class and avoid old c functions, if you are going to use c++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With