i have string this: 001,"john marvin","doctor", "full time" want delete after (001) substr, but, length of (001) not 3 can not put thie:
string chain = "001,\"john marvin\",\"doctor\", \"full time\"";
std::string partial = chain.substr(0,3);
how can proceed in case?
you find index of first comma , use determine cut off string.
something like:
string chain = "001,\"john marvin\",\"doctor\", \"full time\""; int cutoff = chain.find(','); string newstring = chain.substr(0, cutoff);
tested here.
Comments
Post a Comment