cmSystemTools: Generalize TrimWhitespace to all whitespace
Modify cmSystemTools::TrimWhitespace() to remove all leading and trailing whitespace, not just spaces.
This commit is contained in:
parent
b9e4a5abb4
commit
674f918a1a
@ -203,13 +203,13 @@ std::string cmSystemTools::EscapeQuotes(const char* str)
|
|||||||
std::string cmSystemTools::TrimWhitespace(const std::string& s)
|
std::string cmSystemTools::TrimWhitespace(const std::string& s)
|
||||||
{
|
{
|
||||||
std::string::const_iterator start = s.begin();
|
std::string::const_iterator start = s.begin();
|
||||||
while(start != s.end() && *start == ' ')
|
while(start != s.end() && *start <= ' ')
|
||||||
++start;
|
++start;
|
||||||
if (start == s.end())
|
if (start == s.end())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
std::string::const_iterator stop = s.end()-1;
|
std::string::const_iterator stop = s.end()-1;
|
||||||
while(*stop == ' ')
|
while(*stop <= ' ')
|
||||||
--stop;
|
--stop;
|
||||||
return std::string(start, stop+1);
|
return std::string(start, stop+1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user