Removing char from vector of vectors

If I have a vector of vector strings. I want to remove all duplicate words in the vector of vectors the contain a certain character. What would be an efficient way to do this?
Last edited on
Not sure I understood, do you have vector <string> svvar1 and want to remove duplicate strings? or just strings containing certain characters?
I have not understood what means words "
the contain a certain character.

If words in the vector are sorted then you can use algorithm std::unique
I have a vector<vector<string>>
I only want to remove part of the vector<string> that has a "word" that contains a * in it. For example
vector 1 = "something*here is running "
vector 2 = "this*program is not working"
vector 3 = "this*program partial working "

All the vectors are in alphabetical order.
I need to get it into
vector 1 = "something*here is running"
vector 2 ="this*program is not working"
vector 3 = "partial working"

ie removing the duplicates of the words containing * , so allowing one word with * to exist.

Last edited on
i think just use member function erase that vector class provides to remove the vector. for example:
vector <vector<string> > vec;
//remove the 2nd one
vec.erase(vec.begin() + 1);

actually vector will erase the pos regardless what it contains.
Last edited on
Topic archived. No new replies allowed.