Suppose I have a string and I want to find whether a specific character (like \'|\') is present or not, what is the best and fastest technique to do so? I know string find i
Another way is to use the strchr function on the corresponding c_str string:
if(strchr(str.c_str(), '|')) { \\found }
Not sure how it compares to std find in terms of speed though...
The position of the found character is
size_t pos = strchr(str.c_str(),'|') - str.c_str();