sgp4/Util.cpp

29 lines
584 B
C++
Raw Normal View History

#include "Util.h"
2011-12-22 14:28:31 +00:00
#include <algorithm>
#include <locale>
namespace Util
{
2011-12-22 14:28:31 +00:00
void TrimLeft(std::string& s)
{
2011-12-22 14:28:31 +00:00
s.erase(s.begin(),
std::find_if(s.begin(), s.end(),
std::not1(std::ptr_fun<int, int>(std::isspace))));
}
2011-12-22 14:28:31 +00:00
void TrimRight(std::string& s)
{
2011-12-22 14:28:31 +00:00
s.erase(std::find_if(s.rbegin(), s.rend(),
std::not1(std::ptr_fun<int, int>(std::isspace))).base(),
s.end());
}
2011-12-22 14:28:31 +00:00
void Trim(std::string& s)
{
2011-12-22 14:28:31 +00:00
TrimLeft(s);
TrimRight(s);
}
}