From 1909093cacbe3ca090138bca410f6ab837754f4c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 5 Feb 2014 11:04:29 +0000 Subject: [PATCH] Improved the white space trimming --- src/osgDB/XmlParser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osgDB/XmlParser.cpp b/src/osgDB/XmlParser.cpp index 98cf72dfa..ffde756bb 100644 --- a/src/osgDB/XmlParser.cpp +++ b/src/osgDB/XmlParser.cpp @@ -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);