std::string 是否包含字串

来源:互联网 发布:mac怎么解压zip 编辑:程序博客网 时间:2024/04/28 02:01

std::string str = "abcdefghijklmn"

std::string str2 = "defg"

判断str是否包含str2:

std::string::size_type postion = str.find(str2);

如果position == npos  则,不包含字串;反之,包含

0 0