注意是去掉strDrop中包含的所有字符。
template<typename StrType>
inline StrType BinaryDecisionTree::LeftTrimString(const StrType& strSource, const StrType& strDrop)
{
StrType strDstString(strSource);
return strDstString.erase(0, strDstString.find_first_not_of(strDrop));
}
template<typename StrType>
inline StrType BinaryDecisionTree::RightTrimString(const StrType& strSource, const StrType& strDrop)
{
StrType strDstString(strSource);
return strDstString.erase(strDstString.find_last_not_of(strDrop) + 1);
}
template<typename StrType>
inline StrType BinaryDecisionTree::TrimString(const StrType& strSource, const StrType& strDrop)
{
return LeftTrimString(RightTrimString(strSource, strDrop), strDrop);
}