Improved white space trimming
This commit is contained in:
@@ -49,10 +49,12 @@ std::string osgDB::trimEnclosingSpaces(const std::string& str)
|
||||
{
|
||||
if (str.empty()) return str;
|
||||
|
||||
std::string::size_type start = str.find_first_not_of(' ');
|
||||
const std::string whitespaces(" \t\f\v\n\r");
|
||||
|
||||
std::string::size_type start = str.find_first_not_of(whitespaces);
|
||||
if (start==std::string::npos) return std::string();
|
||||
|
||||
std::string::size_type end = str.find_last_not_of(' ');
|
||||
std::string::size_type end = str.find_last_not_of(whitespaces);
|
||||
if (end==std::string::npos) return std::string();
|
||||
|
||||
return std::string(str, start, (end-start)+1);
|
||||
|
||||
Reference in New Issue
Block a user