Filter a vector of strings by another , remove all those elements that are not in the second list
int remove_if_not_in_list( vector<string> & vsToCheck, const vector<string> & vsList, bool bCaseSensitive = false )
number of elements removed.
EX1
void remove_if_not_in_list_ex1() { vector<string> vsToCheck = {"Hello","hi","Sorry","oo"}; vector<string> vsList = {"Hello","hi","FT","Ex","oo"}; bool bCaseSensitive = true; int nRet = remove_if_not_in_list(vsToCheck,vsList,bCaseSensitive); if(nRet) { printf("element deleted number is %d \n" ,nRet); //Should print "Hello hi oo " for(int ii=0; ii<vsToCheck.GetSize(); ii++) printf("%s ",vsToCheck[ii]); } else printf("remove failed\n"); }
remove_if_in_list
origin.h