find()和find_first_of()

std::string chars = "abcd";
std::string str = "0123a5678abcd";

str.find(chars)的值是9
str.find_first_of(chars)的值是4

解释
find()是从str 中查找第一次完全匹配于 chars 的位置。
find_first_if() 是从str 中查找匹配于 chars 中任一字符的位置。此时的chars 更多的像一个用来匹配的字符的集合,而不是一个字符串。

原文地址:https://www.cnblogs.com/mumuliang/p/1873571.html