Trying to compare strings using:
!(stringvector[i]).compare(vector[j][k])
only works for some entries of
vector[j][k]
-- namely ones that are a case sensitive string match.
How do I get case-insensitive matching from this functionality?
Here is a bit of code I was working on
#include <iostream>
#include <vector>
#include <string>
using namespace std; //poor form
vector<string> stringvector = {"Yo", "YO", "babbybabby"};
vector<string> vec1 = {"yo", "Yo" , "these"};
vector<string> vec2 = {"these", "checked" , "too" , "Yo", "babbybabby"};
vector<vector<string>> vvs = {vec1, vec2};
for (int v = 0; v < vvs.size(); v++) //first index of vector
{
for(int s = 0; s < vvs[v].size(); s++) //second index of vector
{
for(int w = 0; w < stringvector.size(); w++)
{
if (stringvector[w] == vvs[v][s])
{cout << "******FOUND******";}
}
}
}
This doesn't print out FOUND for the case-insensitive matches.
Stringvector[w] == vvs[v][s] does not make case-insensitive comparison, is there a way to add this functionality easily?
--Prof D