I’m using two string vectors to store two text files. I need to compare both and change the word to “*” of matched words. I have got all that working for strings that match 100% (‘bat’ to ‘bat’) but I need it to also include battle as it has the string ‘bat’ in it. I have tried to use strcmp but have had no luck! If anyone can be helpful and try and point me in the right direction. Thank you. The testlist vector contains all the word list and the inputlist contains the raw-data (sentences and words).
Here are the codes:
for (int j=0; j < testlist.size(); j++)
{
for (int i = 0; i < inputlist.size(); i++)
{
if (inputlist[i] == testlist[j])
{
inputlist[i] ="*";
}
}
}
you can use
find()instead ofstrcmp()