From Philip's code
How can i edit so that it is not sort between underscores....Code:struct sort_between_underscores
{
int ToInt(const std::string& str)
{
int x;
std::stringstream ss(str);
ss >> x;
return x;
}
int BetweenUnderscores(const std::string& fname)
{
std::string::size_type pos1 = fname.find("_");
std::string::size_type pos2 = fname.find("_",pos1+1);
return ToInt(fname.substr(pos1+1,pos2-pos1-1));
}
bool operator () (const std::string& lhs, const std::string& rhs)
{
return BetweenUnderscores(lhs) < BetweenUnderscores(rhs);
}
};
I wanted it to sort by strcmp. Can it be done? :confused:
Thanks.....