If I have vector of string vector<string> vec and want to find last occurrence of some character ',' in the complete vector then split the string to three separate elements in the vector in the same place.
vector<string> vec1 = { "string1","str,in,g2" , ",string3 " , "my,target" ," string4" };
vector<string> vec2 = { "string1","str,in,g2" , ",string3 " , "my,tar,get" ," string4" };
I want to convert the vector to:
vector<string> vec1 = { "string1","str,in,g2" , ",string3 " , "my" , "," , "target" , "string4" };
vector<string> vec1 = { "string1","str,in,g2" , ",string3 " , "my,tar" , "," , "get" , "string4" };
is there a short way to that rather than check every string from the end of the vector and copy it to new one ?
I'am using c++11 .
Aucun commentaire:
Enregistrer un commentaire