修改时间:2021-10-26 CString判断是否含有子字符串: CString str = L"aaabb" CString bb = L"bb"; if (str.Find(bb) != -1) { //含有子字符串 } String判断是否含有子字符串: std::string findstr = "aabb"; std::string bb = "bb"; int idx = findstr.find(bb);//在aa中查找bb. if (idx != std::string::npos)//不存在。 { //含有子字符串 }