C++中查找字符串中的所有某个字串

//查找s 中子串出现的所有位置
    sonStr="abc";
    vector<int> strNumber;
    position=0; //用来记录子串出现的位置
    while((position=s.find(flag,position))!=string::npos)
    {
        strNumber.push_back(position);
        position++;
    }

版权声明:本文为qq_27538633原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。