如何判断字符串中,包含子字符串

2024-12-01 16:30:26
推荐回答(1个)
回答(1):

string strDec = "天网";
string strFirewall = "防火墙";
//返回-1,表是不包含子字符串
if((strSrc.find(strDec) != -1) && (strSrc.find(strFirewall) != -1)){AfxMessageBox("源字符串中包含要查找的子字符串");}else{AfxMessageBox("源字符串中No found 子字符串");}}