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 更多的像一个用来匹配的字符的集合,而不是一个字符串。

相关文章:

  • 2021-12-12
  • 2022-12-23
  • 2021-12-22
  • 2021-09-20
  • 2022-12-23
  • 2022-02-26
  • 2021-05-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2022-02-21
  • 2022-12-23
相关资源
相似解决方案